handle cursorUp/Down and +/-
authorClaus Gittinger <cg@exept.de>
Tue, 21 Apr 1998 19:57:01 +0200
changeset 868 0fa479aee842
parent 867 f219de09280a
child 869 a1838cce9641
handle cursorUp/Down and +/-
UpDownButton.st
--- a/UpDownButton.st	Sat Apr 18 16:25:56 1998 +0200
+++ b/UpDownButton.st	Tue Apr 21 19:57:01 1998 +0200
@@ -190,6 +190,36 @@
     self initializeButtonDimensions
 ! !
 
+!UpDownButton methodsFor:'event handling'!
+
+keyPress:aKey x:x y:y
+    "simulate a buttonPress/release"
+
+    |theButton theController|
+
+    ((aKey == #CursorUp)
+    or:[aKey == #CursorRight
+    or:[aKey == $+]]) ifTrue:[
+        theButton := upButton
+    ] ifFalse:[
+        ((aKey == #CursorDown)
+        or:[aKey == #CursorLeft 
+        or:[aKey == $-]]) ifTrue:[
+            theButton := downButton
+        ].
+    ].
+    theButton notNil ifTrue:[
+        theController := theButton controller.
+        theController pressed:true.
+        theController pressed:false.
+        ^ self
+    ].
+    ^ super keyPress:aKey x:x y:y
+
+    "Created: / 21.4.1998 / 19:48:28 / cg"
+    "Modified: / 21.4.1998 / 19:56:28 / cg"
+! !
+
 !UpDownButton methodsFor:'initialization'!
 
 initialize
@@ -241,5 +271,5 @@
 !UpDownButton class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/UpDownButton.st,v 1.8 1998-04-09 13:19:05 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/UpDownButton.st,v 1.9 1998-04-21 17:57:01 cg Exp $'
 ! !