MCPcopy
hub / github.com/lxn/walk / SetText

Method SetText

textedit.go:138–155  ·  view source on GitHub ↗
(text string)

Source from the content-addressed store, hash-verified

136}
137
138func (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
157func (te *TextEdit) CompactHeight() bool {
158 return te.compactHeight

Callers 4

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
NewTextEditWithStyleFunction · 0.45

Calls 5

TextMethod · 0.95
SendMessageMethod · 0.65
RequestLayoutMethod · 0.65
setTextMethod · 0.45
PublishMethod · 0.45

Tested by

no test coverage detected