gocui panic loads nocui
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7b611d3dda
commit
e8b090efe6
22
checkbox.go
22
checkbox.go
|
@ -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
10
main.go
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue