summaryrefslogtreecommitdiff
path: root/new-structs.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2021-10-31 04:06:46 -0500
committerJeff Carr <[email protected]>2021-10-31 04:06:46 -0500
commitc446acf4d1b831b7858c6d658bcd87678d579cfb (patch)
tree56011cd592f74d9693aae41e97021064af1f8da7 /new-structs.go
parente5638b8079728e66b09071ec8af1d2b423b9eb76 (diff)
NODE: make node entries for the buttons
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'new-structs.go')
-rw-r--r--new-structs.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/new-structs.go b/new-structs.go
index 915f881..9e1ae3d 100644
--- a/new-structs.go
+++ b/new-structs.go
@@ -50,6 +50,7 @@ type Node struct {
window *GuiWindow
box *GuiBox
+ custom func(*Node)
uiControl *ui.Control
uiButton *ui.Button
@@ -123,7 +124,7 @@ func (n *Node) Append(child *Node) {
// time.Sleep(3 * time.Second)
}
-func (n *Node) AppendButton(name string, custom func(*Node)) *Node {
+func (n *Node) AddButton(name string, custom func(*Node)) *Node {
if (n.uiBox == nil) {
log.Println("gui.Node.AppendButton() filed node.UiBox == nil")
return n
@@ -133,13 +134,18 @@ func (n *Node) AppendButton(name string, custom func(*Node)) *Node {
log.Println("reflect.TypeOF(uiButton) =", reflect.TypeOf(button))
n.uiBox.Append(button, false)
n.uiButton = button
+
+ newNode := n.makeNode(name, 888, 888 + Config.counter)
+ newNode.uiButton = button
+ newNode.custom = custom
+
button.OnClicked(func(*ui.Button) {
log.Println("gui.AppendButton() Button Clicked. Running custom()")
- custom(n)
+ custom(newNode)
})
// panic("AppendButton")
// time.Sleep(3 * time.Second)
- return n
+ return newNode
}
func (n *Node) List() {