gocui panic loads nocui

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-09 09:30:23 -06:00
parent 7b611d3dda
commit e8b090efe6
2 changed files with 32 additions and 0 deletions

View File

@ -2,9 +2,31 @@ package main
import (
log "go.wit.com/log"
"go.wit.com/toolkits/tree"
"go.wit.com/widget"
)
func setChecked(n *tree.Node, b bool) {
if n.WidgetType != widget.Checkbox {
}
var tk *guiWidget
tk = n.TK.(*guiWidget)
if tk.node.State.Label == "" {
tk.node.State.Label = "BLANK"
}
if tk.node.State.Checked {
log.Log(WARN, "setCheckbox() got true", tk.node.State.Checked)
tk.labelN = "X " + tk.node.State.Label
} else {
log.Log(WARN, "setCheckbox() got false", tk.node.State.Checked)
tk.labelN = " " + tk.node.State.Label
}
tk.Hide()
tk.Show()
}
// redraw the checkbox
func (w *guiWidget) setCheckbox() {
if w.node.WidgetType != widget.Checkbox {

10
main.go
View File

@ -14,6 +14,14 @@ import (
"go.wit.com/toolkits/tree"
)
func queueToolkitClose() {
me.baseGui.Close()
}
func queueSetChecked(n *tree.Node, b bool) {
setChecked(n, b)
}
// sets defaults and establishes communication
// to this toolkit from the wit/gui golang package
func init() {
@ -33,6 +41,8 @@ func init() {
me.myTree.SetLabel = newSetLabel
me.myTree.SetText = newSetText
me.myTree.AddText = newAddText
me.myTree.SetChecked = queueSetChecked
me.myTree.ToolkitClose = queueToolkitClose
log.Log(NOW, "Init() start pluginChan")
log.Sleep(.1) // probably not needed, but in here for now under development