2024-01-01 16:11:54 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
2024-01-10 15:35:42 -06:00
|
|
|
|
|
|
|
"go.wit.com/log"
|
2024-01-01 16:11:54 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func (p *node) newCombobox(n *node) {
|
|
|
|
newt := new(guiWidget)
|
|
|
|
|
|
|
|
cb := ui.NewEditableCombobox()
|
|
|
|
newt.uiEditableCombobox = cb
|
|
|
|
newt.uiControl = cb
|
|
|
|
|
|
|
|
// initialize the index
|
|
|
|
newt.c = 0
|
|
|
|
newt.val = make(map[int]string)
|
|
|
|
|
|
|
|
cb.OnChanged(func(spin *ui.EditableCombobox) {
|
2024-01-11 17:19:47 -06:00
|
|
|
n.value = spin.Text()
|
2024-01-10 15:35:42 -06:00
|
|
|
log.Warn("combobox changed =" + spin.Text() + ".")
|
2024-01-01 16:11:54 -06:00
|
|
|
n.doUserEvent()
|
|
|
|
})
|
|
|
|
|
|
|
|
n.tk = newt
|
|
|
|
p.place(n)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *guiWidget) AddComboboxName(title string) {
|
|
|
|
t.uiEditableCombobox.Append(title)
|
|
|
|
if (t.val == nil) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
t.val[t.c] = title
|
|
|
|
|
|
|
|
// If this is the first menu added, set the dropdown to it
|
|
|
|
// if (t.c == 0) {
|
|
|
|
// }
|
|
|
|
t.c = t.c + 1
|
|
|
|
}
|