2021-10-04 21:54:16 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
2021-10-25 09:34:31 -05:00
|
|
|
var mybox *ui.Box
|
|
|
|
|
2021-10-27 16:31:54 -05:00
|
|
|
func (n *Node) AddGroup(title string) *Node {
|
|
|
|
hbox := n.uiBox
|
|
|
|
if (hbox == nil) {
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
group := ui.NewGroup(title)
|
|
|
|
group.SetMargined(true)
|
|
|
|
hbox.Append(group, true)
|
|
|
|
|
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
|
|
|
group.SetChild(vbox)
|
|
|
|
|
|
|
|
newNode := n.AddNode(title)
|
|
|
|
newNode.uiBox = vbox
|
|
|
|
return newNode
|
|
|
|
}
|
|
|
|
|
2021-10-28 04:10:48 -05:00
|
|
|
func (n *Node) GetText(name string) string {
|
2021-10-27 16:31:54 -05:00
|
|
|
if (n.uiText != nil) {
|
|
|
|
return n.uiText.Text()
|
|
|
|
}
|
|
|
|
return n.Name
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *Node) AddComboBox(title string, s ...string) *Node {
|
|
|
|
box := n.uiBox
|
|
|
|
if (box == nil) {
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
2021-10-28 06:27:27 -05:00
|
|
|
log.Println("node.Name = '" + n.Name + "' text for '" + title + "' is now: '" + test + "'")
|
2021-10-27 16:31:54 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
box.Append(ecbox, false)
|
|
|
|
|
|
|
|
newNode := n.AddNode(title)
|
|
|
|
newNode.uiText = ecbox
|
|
|
|
return newNode
|
|
|
|
}
|