summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/combobox.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-27 10:46:54 -0500
committerJeff Carr <[email protected]>2023-04-27 10:46:54 -0500
commit8100e7a1abdc31afbf65af6d0b7cd7cb0fff69eb (patch)
tree7722df0af4968b6fac7d2ea544296c8b8f7db1f4 /toolkit/andlabs/combobox.go
parente3dbd4b2074c80cc089e54495ff2df3f94afabab (diff)
andlabs: more code cleanup
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/combobox.go')
-rw-r--r--toolkit/andlabs/combobox.go33
1 files changed, 9 insertions, 24 deletions
diff --git a/toolkit/andlabs/combobox.go b/toolkit/andlabs/combobox.go
index 293cc42..06a7f41 100644
--- a/toolkit/andlabs/combobox.go
+++ b/toolkit/andlabs/combobox.go
@@ -3,29 +3,27 @@ package main
import (
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
- "git.wit.org/wit/gui/toolkit"
)
-func (t *andlabsT) newCombobox(a *toolkit.Action) *andlabsT {
- var newt andlabsT
- log(debugToolkit, "newCombobox() START", a.Name)
+func (p *node) newCombobox(n *node) {
+ newt := new(andlabsT)
+ log(debugToolkit, "newCombobox() START", n.Name)
- newt.wId = a.WidgetId
- newt.WidgetType = a.WidgetType
- s := ui.NewEditableCombobox()
- newt.uiEditableCombobox = s
- newt.uiControl = s
+ cb := ui.NewEditableCombobox()
+ newt.uiEditableCombobox = cb
+ newt.uiControl = cb
// initialize the index
newt.c = 0
newt.val = make(map[int]string)
- s.OnChanged(func(spin *ui.EditableCombobox) {
+ cb.OnChanged(func(spin *ui.EditableCombobox) {
newt.s = spin.Text()
newt.doUserEvent()
})
- return &newt
+ n.tk = newt
+ p.place(n)
}
func (t *andlabsT) AddComboboxName(title string) {
@@ -41,16 +39,3 @@ func (t *andlabsT) AddComboboxName(title string) {
// }
t.c = t.c + 1
}
-
-func newCombobox(a *toolkit.Action) {
- log(debugToolkit, "newCombobox()", a.Name)
-
- t := andlabs[a.ParentId]
- if (t == nil) {
- log(debugToolkit, "newCombobox() toolkit struct == nil. name=", a.Name)
- listMap(debugToolkit)
- return
- }
- newt := t.newCombobox(a)
- place(a, t, newt)
-}