debian/andlabs/textbox.go

33 lines
535 B
Go
Raw Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
)
func (p *node) newTextbox(n *node) {
newt := new(guiWidget)
if (n.X == 1) {
e := ui.NewEntry()
newt.uiEntry = e
newt.uiControl = e
e.OnChanged(func(spin *ui.Entry) {
n.S = spin.Text()
n.doUserEvent()
})
} else {
e := ui.NewNonWrappingMultilineEntry()
newt.uiMultilineEntry = e
newt.uiControl = e
e.OnChanged(func(spin *ui.MultilineEntry) {
n.S = spin.Text()
n.doUserEvent()
})
}
n.tk = newt
p.place(n)
}