diff options
Diffstat (limited to 'button.go')
| -rw-r--r-- | button.go | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -2,7 +2,7 @@ package gui import "log" -func (n *Node) AddButton(name string, custom func(*Node)) *Node { +func (n *Node) NewButton(name string, custom func()) *Node { if (n.toolkit == nil) { log.Println("gui.Node.AppendButton() filed node.toolkit == nil") panic("gui.Node.AppendButton() filed node.toolkit == nil") @@ -10,9 +10,12 @@ func (n *Node) AddButton(name string, custom func(*Node)) *Node { } newNode := n.New(name) newNode.toolkit = n.toolkit.NewButton(name) + + // TODO: this is still confusing and probably wrong. This needs to communicate through a channel newNode.toolkit.Custom = func() { - log.Println("gui.AppendButton() Button Clicked. Running custom()") - custom(newNode) + log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit START") + custom() + log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit END") } newNode.custom = custom |
