summaryrefslogtreecommitdiff
path: root/andlabs/checkbox.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-01 16:11:54 -0600
committerJeff Carr <[email protected]>2024-01-01 16:11:54 -0600
commit36218f4535dd65d2c8d4ecbea761b3b0289e6f3c (patch)
tree24cf9c64dd518528f30a6282e879e8e5c6136bd4 /andlabs/checkbox.go
move into seperate repo
Diffstat (limited to 'andlabs/checkbox.go')
-rw-r--r--andlabs/checkbox.go27
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()
+}