summaryrefslogtreecommitdiff
path: root/checkbox.go
diff options
context:
space:
mode:
Diffstat (limited to 'checkbox.go')
-rw-r--r--checkbox.go52
1 files changed, 27 insertions, 25 deletions
diff --git a/checkbox.go b/checkbox.go
index 0284920..0aa6aeb 100644
--- a/checkbox.go
+++ b/checkbox.go
@@ -2,34 +2,13 @@ package gui
import "log"
-import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
-
-func (n *Node) verify() {
- if (n.toolkit == nil) {
- log.Println("gui/wit node.Verify(): toolkit == nil", n.Name)
- panic("gui/wit node.Verify(): toolkit == nil")
- }
-}
-
func (n *Node) Checked() bool {
n.Dump()
return n.checked
}
-func (n *Node) NewCheckbox(name string) *Node {
- var newt *toolkit.Toolkit
- var c *Node
-
- log.Println("toolkit.NewCheckbox() START", name)
-
- n.verify()
-
- // make a *Node with a *toolkit.Group
- c = n.New(name + " part1")
- newt = n.toolkit.NewCheckbox(name)
- newt.Name = name
- c.toolkit = newt
- c.custom = n.custom
+/*
+This was the old code
newt.Custom = func () {
println("AM IN CALLBACK. SETTING NODE.checked START")
if newt.Checked() {
@@ -42,7 +21,30 @@ func (n *Node) NewCheckbox(name string) *Node {
commonCallback(c)
println("AM IN CALLBACK. SETTING NODE.checked END")
}
- c.Dump()
+*/
+
+
+func (n *Node) NewCheckbox(name string) *Node {
+ newNode := n.New(name)
+ newNode.custom = n.custom
+
+ newNode.Widget.Custom = func() {
+ log.Println("even newer clicker() name", newNode.Widget)
+ if (n.custom != nil) {
+ n.custom()
+ } else {
+ log.Println("wit/gui No callback function is defined for button name =", name)
+ }
+ }
+
+ for _, aplug := range allPlugins {
+ log.Println("gui.NewCheckbox() aplug =", aplug.name, "name =", newNode.Widget.Name)
+ if (aplug.NewCheckbox == nil) {
+ log.Println("\tgui.NewCheckbox() aplug.NewCheckbox = nil", aplug.name)
+ continue
+ }
+ aplug.NewCheckbox(&n.Widget, &newNode.Widget)
+ }
- return c
+ return newNode
}