diff options
| author | Jeff Carr <[email protected]> | 2024-01-01 16:11:54 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-01 16:11:54 -0600 |
| commit | 36218f4535dd65d2c8d4ecbea761b3b0289e6f3c (patch) | |
| tree | 24cf9c64dd518528f30a6282e879e8e5c6136bd4 /andlabs/checkbox.go | |
move into seperate repo
Diffstat (limited to 'andlabs/checkbox.go')
| -rw-r--r-- | andlabs/checkbox.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/andlabs/checkbox.go b/andlabs/checkbox.go new file mode 100644 index 0000000..4c37fd6 --- /dev/null +++ b/andlabs/checkbox.go @@ -0,0 +1,27 @@ +package main + +import ( + "github.com/andlabs/ui" + _ "github.com/andlabs/ui/winmanifest" +) + +func (p *node) newCheckbox(n *node) { + newt := new(guiWidget) + log(debugToolkit, "newCheckbox()", n.Name, n.WidgetType) + + newt.uiCheckbox = ui.NewCheckbox(n.Text) + newt.uiControl = newt.uiCheckbox + + newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) { + n.B = newt.checked() + log(debugChange, "val =", n.B) + n.doUserEvent() + }) + + n.tk = newt + p.place(n) +} + +func (t *guiWidget) checked() bool { + return t.uiCheckbox.Checked() +} |
