summaryrefslogtreecommitdiff
path: root/redo/area.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-21 05:37:24 -0400
committerPietro Gagliardi <[email protected]>2014-08-21 05:37:24 -0400
commite5c74b832be68fdbefb9c7527c2367dba1cec7a8 (patch)
treebff78082b8666a04ce42b815b11a65ddee77821d /redo/area.go
parentf3ca234dda0c34c2bd11acee414111d1c745422d (diff)
Changed AreaHandler.Key() to return a boolean value indicating if the event was handled; implemented this on Windows. It does sledgehammer some edge cases I wanted to avoid, but it also avoids fussing about scrolling and focus and what not.
Diffstat (limited to 'redo/area.go')
-rw-r--r--redo/area.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/redo/area.go b/redo/area.go
index b4b2f78..75f47b2 100644
--- a/redo/area.go
+++ b/redo/area.go
@@ -74,10 +74,10 @@ type AreaHandler interface {
Mouse(e MouseEvent)
// Key is called when the Area receives a keyboard event.
- // You are allowed to do nothing in this handler (to ignore keyboard events).
+ // Return true to indicate that you handled the event; return false to indicate that you did not and let the system handle the event.
+ // You are allowed to do nothing in this handler (to ignore keyboard events); in this case, return false.
// See KeyEvent for details.
- // After handling the key event, package ui will decide whether to perform platform-dependent event chain continuation based on that platform's designated action (so it is not possible to override global key events, such as Alt-Tab, this way).
- Key(e KeyEvent)
+ Key(e KeyEvent) (handled bool)
}
// MouseEvent contains all the information for a mous event sent by Area.Mouse.
@@ -140,7 +140,7 @@ func (e MouseEvent) HeldBits() (h uintptr) {
// on US English QWERTY keyboards; see Key for details.
//
// If a key is pressed that is not supported by Key, ExtKey,
-// or Modifiers, no KeyEvent will be produced.
+// or Modifiers, no KeyEvent will be produced and package ui will behave as if false was returned from the event handler.
type KeyEvent struct {
// Key is a byte representing a character pressed
// in the typewriter section of the keyboard.