--- a/PluggableEventListener.st Fri Sep 19 19:46:06 2014 +0200
+++ b/PluggableEventListener.st Tue Sep 23 13:36:30 2014 +0200
@@ -49,7 +49,7 @@
example
"
- eat a particular key from another view.
+ to eat a particular key from another view:
|v e|
@@ -65,10 +65,30 @@
Transcript showCR:'a key eaten'.
true.
] ifFalse:[
- Transcript showCR:'other key ok'.
+ Transcript showCR:'other key ok:',event key printString.
false
]
]).
+
+ to get events for a hotKey (attention: synchronous,
+ so you better enqueue the event into an application's private queue
+ in the handler block)
+
+ Display rootView
+ addHotKeyHandler:(
+ PluggableEventListener new
+ keyPressAction:[:event |
+ Transcript showCR:event.
+ event key = 'F2' ifTrue:[
+ Transcript showCR:'F2 pressed'.
+ true.
+ ] ifFalse:[
+ Transcript showCR:'other key ok:',event key printString.
+ false
+ ]
+ ])
+ forKey:'F2'
+ modifierMask:nil
"
! !
@@ -120,10 +140,10 @@
!PluggableEventListener class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/PluggableEventListener.st,v 1.1 2014-09-19 17:45:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/PluggableEventListener.st,v 1.2 2014-09-23 11:36:30 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview2/PluggableEventListener.st,v 1.1 2014-09-19 17:45:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/PluggableEventListener.st,v 1.2 2014-09-23 11:36:30 cg Exp $'
! !