blob: 293cc42454338fc3e996d60829548b9af4f16b65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
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)
newt.wId = a.WidgetId
newt.WidgetType = a.WidgetType
s := ui.NewEditableCombobox()
newt.uiEditableCombobox = s
newt.uiControl = s
// initialize the index
newt.c = 0
newt.val = make(map[int]string)
s.OnChanged(func(spin *ui.EditableCombobox) {
newt.s = spin.Text()
newt.doUserEvent()
})
return &newt
}
func (t *andlabsT) 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
}
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)
}
|