summaryrefslogtreecommitdiff
path: root/button.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-11-09 08:38:50 -0600
committerJeff Carr <[email protected]>2022-11-09 08:38:50 -0600
commited382bec55be25039e4dcf020d1512139855c9bb (patch)
treefb3a671fd07c03a75cedb8d56b2241108cd792ff /button.go
parentb410d0fd083ee89eed410cda2123a22cddcd3f44 (diff)
cleanup of the example commands. more plugin workv0.4.6
add a button in two plugins at the same time! added a button in andlabs/ui & gocui attempt a common widget struct between wit/gui & the plugins start handling missing plugins rename Makefile command examples remote examples used for testing filename improvements golang src code uses lowercase and _ in filenames fix crash when button click function == nil fix wrong name 'gocli' -> 'gocui' keep fighting with goreadme generated README.md Signed-off-by: Jeff Carr <[email protected]>
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