close menu when pressing #Escape key
authorfm
Tue, 03 Nov 2009 14:55:06 +0100
changeset 3844 e88634883df1
parent 3843 506061c7069f
child 3845 81fa525dcfa7
close menu when pressing #Escape key
ExtendedComboBox.st
--- a/ExtendedComboBox.st	Tue Nov 03 13:12:19 2009 +0100
+++ b/ExtendedComboBox.st	Tue Nov 03 14:55:06 2009 +0100
@@ -886,9 +886,19 @@
 processEvent:anEvent
     |evView button point x y|
 
+    anEvent isKeyPressEvent ifTrue:[
+        anEvent key == #Escape ifTrue:[
+            (menuWrapper notNil and:[menuWrapper realized]) ifTrue:[
+                self closeMenu.
+                ^ true.
+            ]
+        ]
+    ].
+
     anEvent isButtonPressEvent ifFalse:[
         ^ false
     ].
+
     button := anEvent state.
     ((button == 1) or:[button == #select]) ifFalse:[
         ^ false
@@ -1533,9 +1543,9 @@
 !ExtendedComboBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ExtendedComboBox.st,v 1.63 2009-11-02 14:39:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ExtendedComboBox.st,v 1.64 2009-11-03 13:55:06 fm Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/ExtendedComboBox.st,v 1.63 2009-11-02 14:39:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ExtendedComboBox.st,v 1.64 2009-11-03 13:55:06 fm Exp $'
 ! !