diff options
| author | Jeff Carr <[email protected]> | 2025-02-06 19:00:00 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-06 19:00:00 -0600 |
| commit | 2a5734892a85804b6c44a0cd8dd22d20fed21d96 (patch) | |
| tree | 55e4164094dd468a8ef1812ed1cae5e7a605fc01 /checkbox.go | |
| parent | f5d465901d2ec48e145c3c7ce04eceb69445a11f (diff) | |
trying to fix Hidden() to use the parent
Diffstat (limited to 'checkbox.go')
| -rw-r--r-- | checkbox.go | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/checkbox.go b/checkbox.go index 4b5f4f2..8e949b2 100644 --- a/checkbox.go +++ b/checkbox.go @@ -9,17 +9,24 @@ import ( "go.wit.com/widget" ) +// this comes from the application func setChecked(n *tree.Node, b bool) { if n.WidgetType != widget.Checkbox { } + + n.State.Checked = b var tk *guiWidget tk = n.TK.(*guiWidget) - /* - if tk.node.State.Label == "" { - tk.node.State.Label = "BLANK" - } - */ + tk.setCheckbox() +} + +// redraw the checkbox +func (tk *guiWidget) setCheckbox() { + if tk.node.WidgetType != widget.Checkbox { + log.Log(WARN, "setCheckbox() being run on widget:", tk.node.WidgetType) + return + } if tk.node.State.Checked { log.Log(WARN, "setCheckbox() got true", tk.node.State.Checked) tk.labelN = "X " + tk.node.State.Label @@ -31,30 +38,3 @@ func setChecked(n *tree.Node, b bool) { tk.Hide() tk.Show() } - -// redraw the checkbox -func (w *guiWidget) setCheckbox() { - if w.node.WidgetType != widget.Checkbox { - log.Log(WARN, "setCheckbox() being run on widget:", w.node.WidgetType) - return - } - /* - if w.node.State.Label == "" { - w.node.State.Label = "BLANK" - } - */ - if w.node.State.Checked { - log.Log(WARN, "setCheckbox() got true", w.node.State.Checked) - w.labelN = "X " + w.node.State.Label - // w.changed = true - } else { - log.Log(WARN, "setCheckbox() got false", w.node.State.Checked) - w.labelN = "_ " + w.node.State.Label - // w.changed = true - } - // t := len(w.labelN) + 3 - // w.gocuiSize.w1 = w.gocuiSize.w0 + t - - w.Hide() - w.Show() -} |
