// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( log "go.wit.com/log" "go.wit.com/toolkits/tree" "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) 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 } else { log.Log(WARN, "setCheckbox() got false", tk.node.State.Checked) tk.labelN = "_ " + tk.node.State.Label } tk.Hide() tk.Show() }