andlabs/checkbox.go

31 lines
523 B
Go
Raw Normal View History

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