debian/andlabs/checkbox.go

29 lines
524 B
Go
Raw Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
"go.wit.com/gui/toolkits/tree"
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
2024-01-01 16:11:54 -06:00
)
func newCheckbox(p *tree.Node, n *tree.Node) {
if notNew(n) { return }
2024-01-01 16:11:54 -06:00
newt := new(guiWidget)
newt.uiCheckbox = ui.NewCheckbox(n.GetLabel())
2024-01-01 16:11:54 -06:00
newt.uiControl = newt.uiCheckbox
newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) {
n.SetValue(newt.checked())
me.myTree.DoUserEvent(n)
2024-01-01 16:11:54 -06:00
})
n.TK = newt
place(p, n)
2024-01-01 16:11:54 -06:00
}
func (t *guiWidget) checked() bool {
return t.uiCheckbox.Checked()
}