summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/checkbox.go
blob: 4c690c1a1595e4d402491a2ef8c1d567ebda80fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import (
	"github.com/andlabs/ui"
	_ "github.com/andlabs/ui/winmanifest"
)

func (p *node) newCheckbox(n *node) {
	newt := new(andlabsT)
	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 *andlabsT) checked() bool {
	return t.uiCheckbox.Checked()
}