debian/andlabs/textbox.go

36 lines
644 B
Go
Raw Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
"go.wit.com/gui/toolkits/tree"
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
2024-01-01 16:11:54 -06:00
)
func newTextbox(p, n *tree.Node) {
if notNew(n) { return }
2024-01-01 16:11:54 -06:00
newt := new(guiWidget)
if (n.State.Range.Low == 1) {
2024-01-01 16:11:54 -06:00
e := ui.NewEntry()
newt.uiEntry = e
newt.uiControl = e
e.OnChanged(func(spin *ui.Entry) {
n.SetValue(spin.Text())
me.myTree.DoUserEvent(n)
2024-01-01 16:11:54 -06:00
})
} else {
e := ui.NewNonWrappingMultilineEntry()
newt.uiMultilineEntry = e
newt.uiControl = e
e.OnChanged(func(spin *ui.MultilineEntry) {
n.SetValue(spin.Text())
me.myTree.DoUserEvent(n)
2024-01-01 16:11:54 -06:00
})
}
n.TK = newt
place(p, n)
2024-01-01 16:11:54 -06:00
}