blob: 03d15286f2d11c28dd2cb2ce9d5eda5648080baa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package gui
import "log"
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")
return n
}
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() from outside toolkit START")
custom()
log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit END")
}
newNode.custom = custom
return newNode
}
|