summaryrefslogtreecommitdiff
path: root/checkbox.go
blob: b352758a3e7b7849f52d935b3b2876a414668dd3 (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
28
29
30
31
package main

import (
	log "go.wit.com/log"
	"go.wit.com/widget"
)

// redraw the checkbox
func (w *guiWidget) setCheckbox() {
	if w.node.WidgetType != widget.Checkbox {
		log.Log(WARN, "setCheckbox() being run on widget:", w.node.WidgetType)
		return
	}
	if w.node.State.Label == "" {
		w.node.State.Label = "BLANK"
	}
	if w.node.State.Checked {
		log.Log(WARN, "setCheckbox() got true", w.node.State.Checked)
		w.labelN = "X " + w.node.State.Label
		// w.changed = true
	} else {
		log.Log(WARN, "setCheckbox() got false", w.node.State.Checked)
		w.labelN = "  " + w.node.State.Label
		// w.changed = true
	}
	// t := len(w.labelN) + 3
	// w.gocuiSize.w1 = w.gocuiSize.w0 + t

	w.deleteView()
	w.showView()
}