(text string)
| 136 | } |
| 137 | |
| 138 | func (te *TextEdit) SetText(text string) (err error) { |
| 139 | if text == te.Text() { |
| 140 | return nil |
| 141 | } |
| 142 | |
| 143 | var oldLineCount int |
| 144 | if te.compactHeight { |
| 145 | oldLineCount = int(te.SendMessage(win.EM_GETLINECOUNT, 0, 0)) |
| 146 | } |
| 147 | err = te.setText(text) |
| 148 | if te.compactHeight { |
| 149 | if newLineCount := int(te.SendMessage(win.EM_GETLINECOUNT, 0, 0)); newLineCount != oldLineCount { |
| 150 | te.RequestLayout() |
| 151 | } |
| 152 | } |
| 153 | te.textChangedPublisher.Publish() |
| 154 | return |
| 155 | } |
| 156 | |
| 157 | func (te *TextEdit) CompactHeight() bool { |
| 158 | return te.compactHeight |
no test coverage detected