Use key/button functions for menu
This commit is contained in:
parent
0ccdb609ef
commit
8469962c90
8
menu.go
8
menu.go
@ -92,20 +92,20 @@ func (this *Menu) newTearLine () tomo.Object {
|
||||
tearLine.SetRole(tomo.R("objects", "TearLine"))
|
||||
tearLine.SetFocusable(true)
|
||||
tearLine.OnKeyDown(func (key input.Key, numberPad bool) bool {
|
||||
if key != input.KeyEnter && key != input.Key(' ') { return false }
|
||||
if !isClickingKey(key) { return false }
|
||||
return true
|
||||
})
|
||||
tearLine.OnKeyUp(func (key input.Key, numberPad bool) bool {
|
||||
if key != input.KeyEnter && key != input.Key(' ') { return false }
|
||||
if !isClickingKey(key) { return false }
|
||||
this.TearOff()
|
||||
return true
|
||||
})
|
||||
tearLine.OnButtonDown(func (button input.Button) bool {
|
||||
if button != input.ButtonLeft { return false }
|
||||
if !isClickingButton(button) { return false }
|
||||
return true
|
||||
})
|
||||
tearLine.OnButtonUp(func (button input.Button) bool {
|
||||
if button != input.ButtonLeft { return false }
|
||||
if !isClickingButton(button) { return false }
|
||||
if tearLine.Window().MousePosition().In(tearLine.Bounds()) {
|
||||
this.TearOff()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user