summaryrefslogtreecommitdiff
path: root/button.go
diff options
context:
space:
mode:
Diffstat (limited to 'button.go')
-rw-r--r--button.go23
1 files changed, 18 insertions, 5 deletions
diff --git a/button.go b/button.go
index 1ce7327..7b01e1e 100644
--- a/button.go
+++ b/button.go
@@ -4,21 +4,34 @@ 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")
+ log.Println("gui.Node.NewButton() filed node.toolkit == nil")
+ panic("gui.Node.NewButton() filed node.toolkit == nil")
return n
}
newNode := n.New(name)
newNode.toolkit = n.toolkit.NewButton(name)
+ log.Println("gui.Node.NewButton()", name)
+ if (PlugGocliOk) {
+ log.Println("wit/gui gocui is loaded", PlugGocliOk)
+ greeter.AddButton(name)
+ log.Println("GOT HERE PlugGocliOk TRUE")
+ } else {
+ log.Println("GOT HERE PlugGocliOk FALSE")
+ }
+
// TODO: this is still confusing and probably wrong. This needs to communicate through a channel
newNode.toolkit.Custom = func() {
if (Config.Options.Debug) {
- log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit START")
+ log.Println("gui.Newutton() Button Clicked. Running custom() from outside toolkit START")
+ }
+ if (custom != nil) {
+ custom()
+ } else {
+ log.Println("wit/gui No callback function is defined for button name =", name)
}
- custom()
if (Config.Options.Debug) {
- log.Println("gui.AppendButton() Button Clicked. Running custom() from outside toolkit END")
+ log.Println("gui.NewButton() Button Clicked. Running custom() from outside toolkit END")
}
}
newNode.custom = custom