diff options
Diffstat (limited to 'action.go')
| -rw-r--r-- | action.go | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -34,6 +34,19 @@ func notNew(n *tree.Node) bool { return false } +func tkbad(n *tree.Node) bool { + if n == nil { + log.Warn("ready() n = nil") + return true + } + if n.TK == nil { + log.Warn("ready() n.TK = nil", n.WidgetId, n.GetProgName()) + return true + } + return false +} + +// this makes sure widget and it's parent exists func ready(n *tree.Node) bool { if n == nil { log.Warn("ready() n = nil") @@ -56,6 +69,9 @@ func ready(n *tree.Node) bool { } func show(n *tree.Node, b bool) { + if tkbad(n) { + return + } var tk *guiWidget tk = n.TK.(*guiWidget) // tk = getTK(n) @@ -93,6 +109,9 @@ func enable(n *tree.Node, b bool) { } func pad(n *tree.Node, b bool) { + if tkbad(n) { + return + } log.Warn("pad() on WidgetId =", n.WidgetId) t := n.TK.(*guiWidget) @@ -126,14 +145,16 @@ func widgetDelete(n *tree.Node) { if n.WidgetType == widget.Window { log.Warn("DESTROY uiWindow here") log.Warn("NEED TO REMOVE n from parent.Children") - tk.uiWindow.Destroy() - tk.uiWindow = nil + if tk.uiWindow != nil { + tk.uiWindow.Destroy() + tk.uiWindow = nil + } n.DeleteNode() } } func processAction(a *widget.Action) { - log.Log(INFO, "processAction() START a.ActionType =", a.ActionType, "a.Value", a.Value) + log.Warn("processAction() START a.ActionType =", a.ActionType, "a.Value", a.Value) if a.ActionType == widget.ToolkitInit { Init() @@ -163,7 +184,10 @@ func processAction(a *widget.Action) { } if a.ActionType == widget.Add { - add(a) + n := add(a) + show(n, n.State.Visable) + // pad(n, n.State.Pad) + // expand(n, a.State.Expand) return } @@ -195,6 +219,8 @@ func processAction(a *widget.Action) { case widget.Disable: log.Warn("andlabs got disable for", n.WidgetId, n.State.ProgName) enable(n, false) + case widget.Checked: + setChecked(n, a.State.Checked) case widget.Get: setText(n, a) case widget.GetText: |
