summaryrefslogtreecommitdiff
path: root/button.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-10-21 11:40:08 -0500
committerJeff Carr <[email protected]>2022-10-21 11:40:08 -0500
commita3fc02c2f7e22f92b76ff6db92618be0cf3656a6 (patch)
tree70c05aada2b3acfbb95d1e6e0098291c7f8b6bcf /button.go
parentb8ef0bb05dc14bc4291f3d156b199fa125cdb9d7 (diff)
v0.4.1 set sane toolkit default look and feelv0.4.1
autogenerate README.md from doc.go (goreadme cmd) remove passing arguements on a mouse click() make defaults for padding, margin, stretchy, etc add a checkbox widget function rename to NewButton() keep cleaning up toolkit code fix date. I was somehow in the future Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'button.go')
-rw-r--r--button.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/button.go b/button.go
index 2e2c7b4..03d1528 100644
--- a/button.go
+++ b/button.go
@@ -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