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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
package gui
import "log"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
func (n *Node) AddBox(axis int, name string) *Node {
newBox := new(GuiBox)
newBox.Window = n.window
newBox.Name = name
if (n.box == nil) {
n.box = newBox
}
// make a new box & a new node
newNode := n.makeNode(name, 111, 100 + Config.counter)
newNode.box = newBox
Config.counter += 1
var uiBox *ui.Box
if (axis == Xaxis) {
uiBox = ui.NewHorizontalBox()
} else {
uiBox = ui.NewVerticalBox()
}
uiBox.SetPadded(true)
newBox.UiBox = uiBox
newNode.uiBox = uiBox
n.Append(newNode)
// add(n.box, newBox)
return newNode
}
func HorizontalBreak(box *GuiBox) {
log.Println("VerticalSeparator added to box =", box.Name)
tmp := ui.NewHorizontalSeparator()
if (box == nil) {
return
}
if (box.UiBox == nil) {
return
}
box.UiBox.Append(tmp, false)
}
func VerticalBreak(box *GuiBox) {
log.Println("VerticalSeparator added to box =", box.Name)
tmp := ui.NewVerticalSeparator()
box.UiBox.Append(tmp, false)
}
func (n *Node) AddComboBox(title string, s ...string) *Node {
box := n.uiBox
if (box == nil) {
return n
}
newNode := n.AddNode(title)
ecbox := ui.NewEditableCombobox()
for id, name := range s {
log.Println("Adding Combobox Entry:", id, name)
ecbox.Append(name)
}
ecbox.OnChanged(func(*ui.EditableCombobox) {
test := ecbox.Text()
log.Println("node.Name = '" + n.Name + "' text for '" + title + "' is now: '" + test + "'")
log.Println("need to call node.OnChanged() here")
if (newNode.OnChanged == nil) {
log.Println("node.OnChanged() is nil")
log.Println("need to call node.OnChanged() here", newNode.OnChanged)
newNode.Dump()
} else {
log.Println("need to call node.OnChanged() here", newNode.OnChanged)
newNode.OnChanged(newNode)
}
})
box.Append(ecbox, false)
newNode.uiText = ecbox
return newNode
}
func (n *Node) GetText() string {
if (n.uiText == nil) {
return ""
}
ecbox := n.uiText
return ecbox.Text()
}
|