diff options
| author | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
| commit | 8dbf5a09097b7868e9218bf98716c57eac998a10 (patch) | |
| tree | ab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /checkbox.go | |
| parent | f3bb68396afa7452ecf1c8d4744c825a9d81057c (diff) | |
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing
merge forceDump(bool) into Dump()
debugging output configuration is pretty clean
keep cutting down duplicate things
--gui-verbose flag works
make label "standard" code
add debug.FreeOSMemory()
move the GO language internals to display in the GUI
update push to do tags and go to github.com/wit-go/
remove the other license file
it might be confusing golang.org and github
proper WidgetType
added a Quit() button
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'checkbox.go')
| -rw-r--r-- | checkbox.go | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/checkbox.go b/checkbox.go index 0372a50..068be7b 100644 --- a/checkbox.go +++ b/checkbox.go @@ -1,55 +1,20 @@ package gui +import "git.wit.org/wit/gui/toolkit" + func (n *Node) Checked() bool { n.Dump() - return n.checked + return n.widget.B } -/* -This was the old code - newt.Custom = func () { - println("AM IN CALLBACK. SETTING NODE.checked START") - if newt.Checked() { - println("is checked") - c.checked = true - } else { - println("is not checked") - c.checked = false - } - commonCallback(c) - println("AM IN CALLBACK. SETTING NODE.checked END") - } -*/ - - func (n *Node) NewCheckbox(name string) *Node { - newNode := n.New(name, "Checkbox") - newNode.custom = n.custom - - newNode.Widget.Custom = func() { - log(debugChange, "wit go gui checkbox", newNode.Widget) - if (n.custom != nil) { - log(debugChange, "trying parent.custom() callback() name =", name) - n.custom() - } else { - log(debugChange, "wit/gui No parent.custom() function is defined for button name =", name) - } - if (newNode.custom != nil) { - log(debugChange, "trying newNode.custom() callback name =", name) - newNode.custom() - } else { - log(debugChange, "wit/gui No newNode.custom() function is defined for button name =", name) - } - } - - for _, aplug := range allPlugins { - log(debugGui, "gui.NewCheckbox() aplug =", aplug.name, "name =", newNode.Widget.Name) - if (aplug.NewCheckbox == nil) { - log(debugGui, "\tgui.NewCheckbox() aplug.NewCheckbox = nil", aplug.name) - continue - } - aplug.NewCheckbox(&n.Widget, &newNode.Widget) - } + newNode := n.New(name, toolkit.Checkbox, nil) + send(n, newNode) + return newNode +} +func (n *Node) NewThing(name string) *Node { + newNode := n.New(name, toolkit.Button, nil) + send(n, newNode) return newNode } |
