MCPcopy
hub / github.com/g3n/engine / SetText

Method SetText

gui/image_button.go:85–102  ·  view source on GitHub ↗

SetText sets the text of the label

(text string)

Source from the content-addressed store, hash-verified

83
84// SetText sets the text of the label
85func (b *ImageButton) SetText(text string) {
86
87 if b.iconLabel && b.label != nil {
88 b.Panel.Remove(b.label)
89 b.label.Dispose()
90 b.label = nil
91 }
92
93 b.iconLabel = false
94 if b.label == nil {
95 // Create label
96 b.label = NewLabel(text)
97 b.Panel.Add(b.label)
98 } else {
99 b.label.SetText(text)
100 }
101 b.recalc()
102}
103
104// SetIcon sets the icon
105func (b *ImageButton) SetIcon(icode string) {

Callers 1

SetIconMethod · 0.45

Calls 5

recalcMethod · 0.95
NewLabelFunction · 0.85
DisposeMethod · 0.65
RemoveMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected