diff options
| author | Jeff Carr <[email protected]> | 2024-01-01 16:11:54 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-01 16:11:54 -0600 |
| commit | 36218f4535dd65d2c8d4ecbea761b3b0289e6f3c (patch) | |
| tree | 24cf9c64dd518528f30a6282e879e8e5c6136bd4 /andlabs/combobox.go | |
move into seperate repo
Diffstat (limited to 'andlabs/combobox.go')
| -rw-r--r-- | andlabs/combobox.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/andlabs/combobox.go b/andlabs/combobox.go new file mode 100644 index 0000000..283a29d --- /dev/null +++ b/andlabs/combobox.go @@ -0,0 +1,41 @@ +package main + +import ( + "github.com/andlabs/ui" + _ "github.com/andlabs/ui/winmanifest" +) + +func (p *node) newCombobox(n *node) { + newt := new(guiWidget) + log(debugToolkit, "newCombobox() START", n.Name) + + 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) { + n.S = spin.Text() + n.doUserEvent() + }) + + n.tk = newt + p.place(n) +} + +func (t *guiWidget) AddComboboxName(title string) { + t.uiEditableCombobox.Append(title) + if (t.val == nil) { + log(debugToolkit, "make map didn't work") + 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 +} |
