diff options
Diffstat (limited to 'checkbox.go')
| -rw-r--r-- | checkbox.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/checkbox.go b/checkbox.go index c5f0217..fe46023 100644 --- a/checkbox.go +++ b/checkbox.go @@ -27,32 +27,35 @@ func NewCheckbox(text string) (c *Checkbox) { // SetText sets the checkbox's text. func (c *Checkbox) SetText(text string) { + c.lock.Lock() + defer c.lock.Unlock() + if c.created { c.sysData.setText(text) return } - c.lock.Lock() - defer c.lock.Unlock() c.initText = text } // Text returns the checkbox's text. func (c *Checkbox) Text() string { + c.lock.Lock() + defer c.lock.Unlock() + if c.created { return c.sysData.text() } - c.lock.Lock() - defer c.lock.Unlock() return c.initText } // Checked() returns whether or not the checkbox has been checked. func (c *Checkbox) Checked() bool { + c.lock.Lock() + defer c.lock.Unlock() + if c.created { return c.sysData.isChecked() } - c.lock.Lock() - defer c.lock.Unlock() return false } |
