diff options
Diffstat (limited to 'new-structs.go')
| -rw-r--r-- | new-structs.go | 12 |
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() { |
