Update code for objects
This commit is contained in:
@@ -24,7 +24,7 @@ func NewLabelCheckbox (value bool, text string) *LabelCheckbox {
|
||||
box.label.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle))
|
||||
box.Add(box.checkbox)
|
||||
box.Add(box.label)
|
||||
box.SetLayout(layouts.Row { false, true })
|
||||
box.SetAttr(tomo.ALayout(layouts.Row { false, true }))
|
||||
|
||||
box.OnButtonDown(box.handleButtonDown)
|
||||
box.OnButtonUp(box.handleButtonUp)
|
||||
@@ -52,15 +52,16 @@ func (this *LabelCheckbox) OnValueChange (callback func ()) event.Cookie {
|
||||
return this.checkbox.OnValueChange(callback)
|
||||
}
|
||||
|
||||
func (this *LabelCheckbox) handleButtonDown (capture func (), button input.Button) {
|
||||
capture()
|
||||
func (this *LabelCheckbox) handleButtonDown (button input.Button) bool {
|
||||
if button != input.ButtonLeft { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *LabelCheckbox) handleButtonUp (capture func (), button input.Button) {
|
||||
capture()
|
||||
if button != input.ButtonLeft { return }
|
||||
func (this *LabelCheckbox) handleButtonUp (button input.Button) bool {
|
||||
if button != input.ButtonLeft { return false }
|
||||
if this.Window().MousePosition().In(this.Bounds()) {
|
||||
this.checkbox.SetFocused(true)
|
||||
this.checkbox.Toggle()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user