start work towards toolkitclose()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-07 15:22:47 -06:00
parent dd425dfc81
commit b029617e7d
2 changed files with 9 additions and 3 deletions

11
init.go
View File

@ -49,7 +49,11 @@ func (me *TreeInfo) newAction(a widget.Action) {
case widget.Checked: case widget.Checked:
switch n.WidgetType { switch n.WidgetType {
case widget.Checkbox: case widget.Checkbox:
me.SetChecked(n, a.State.Checked) if me.SetChecked == nil {
log.Log(TREEWARN, "SetChecked() == nil in toolkit", me.PluginName)
} else {
me.SetChecked(n, a.State.Checked)
}
default: default:
log.Log(TREEWARN, "SetChecked() not supported on widget", n.WidgetType, n.String()) log.Log(TREEWARN, "SetChecked() not supported on widget", n.WidgetType, n.String())
} }
@ -61,9 +65,10 @@ func (me *TreeInfo) newAction(a widget.Action) {
func (me *TreeInfo) catchActionChannel() { func (me *TreeInfo) catchActionChannel() {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
log.Log(TREEWARN, me.PluginName, "tree YAHOOOO Recovered in simpleStdin()", r) log.Log(TREEWARN, "YAHOOOO Recovered in tree.catchActionChannel()", r)
log.Log(TREEWARN, "YAHOOOO Recovered in tree.catchActionChannel() Plugin:", me.PluginName)
me.SendToolkitPanic() me.SendToolkitPanic()
panic(-1) me.ToolkitClose()
} }
}() }()
log.Log(TREE, "catchActionChannel() START") log.Log(TREE, "catchActionChannel() START")

View File

@ -31,6 +31,7 @@ type TreeInfo struct {
SetTitle func(*Node, string) SetTitle func(*Node, string)
SetLabel func(*Node, string) SetLabel func(*Node, string)
SetChecked func(*Node, bool) SetChecked func(*Node, bool)
ToolkitClose func()
} }
type Node struct { type Node struct {