summaryrefslogtreecommitdiff
path: root/andlabs/combobox.go
diff options
context:
space:
mode:
Diffstat (limited to 'andlabs/combobox.go')
-rw-r--r--andlabs/combobox.go40
1 files changed, 27 insertions, 13 deletions
diff --git a/andlabs/combobox.go b/andlabs/combobox.go
index 3a25692..0dd16c6 100644
--- a/andlabs/combobox.go
+++ b/andlabs/combobox.go
@@ -1,8 +1,8 @@
package main
import (
- "github.com/andlabs/ui"
- _ "github.com/andlabs/ui/winmanifest"
+ "go.wit.com/dev/andlabs/ui"
+ _ "go.wit.com/dev/andlabs/ui/winmanifest"
"go.wit.com/log"
"go.wit.com/gui/widget"
@@ -28,24 +28,38 @@ func (p *node) newCombobox(n *node) {
n.tk = newt
p.place(n)
- // add the initial dropdown entries
+ // add the initial combobox entries
for i, s := range n.strings {
- log.Warn("add dropdown entries on create", i, s)
- n.addDropdownName(s)
+ log.Warn("add combobox entries on create", n.progname, i, s)
+ n.addComboboxName(s)
}
cur := widget.GetString(n.value)
- n.tk.addComboboxName(cur)
+ log.Warn("add combobox: TODO: set default value on create", n.progname, cur)
+ n.setComboboxName(cur)
}
-func (t *guiWidget) addComboboxName(title string) {
- t.uiEditableCombobox.Append(title)
- if (t.val == nil) {
+func (n *node) addComboboxName(s string) {
+ if ! n.ready() { return }
+ log.Log(INFO, "addComboboxName()", n.WidgetId, "add:", s)
+
+ n.tk.uiEditableCombobox.Append(s)
+ if (n.tk.val == nil) {
+ log.Log(INFO, "make map didn't work")
return
}
- t.val[t.c] = title
+ n.tk.val[n.tk.c] = s
// If this is the first menu added, set the dropdown to it
- // if (t.c == 0) {
- // }
- t.c = t.c + 1
+ if (n.tk.c == 0) {
+ log.Log(INFO, "THIS IS THE FIRST combobox", s)
+ n.tk.uiEditableCombobox.SetText(s)
+ }
+ n.tk.c = n.tk.c + 1
+}
+
+func (n *node) setComboboxName(s string) bool {
+ if ! n.ready() { return false}
+ log.Log(INFO, "SetComboboxName()", n.WidgetId, ",", s)
+ n.tk.uiEditableCombobox.SetText(s)
+ return false
}