PullDMenu.st
changeset 112 81633ba1bf40
parent 110 eb59f6e31e84
child 115 57c0ee9a56c0
--- a/PullDMenu.st	Sat Mar 25 23:22:05 1995 +0100
+++ b/PullDMenu.st	Sun Mar 26 22:16:09 1995 +0200
@@ -33,7 +33,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.13 1995-03-25 22:21:03 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.14 1995-03-26 20:16:09 claus Exp $
 '!
 
 !PullDownMenu class methodsFor:'documentation'!
@@ -54,7 +54,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.13 1995-03-25 22:21:03 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.14 1995-03-26 20:16:09 claus Exp $
 "
 !
 
@@ -505,9 +505,11 @@
 
     index := self indexOf:aString.
     (index == 0) ifTrue:[^ nil].
-    aMenu origin:((left + (self titleLenUpTo:index)) 
-		  @
-		  (height + aMenu borderWidth)).
+
+"/ not needed:
+"/    aMenu origin:((left + (self titleLenUpTo:index)) 
+"/                  @
+"/                  (height + aMenu borderWidth)).
     aMenu hidden:true.
     menus at:index put:aMenu.
     aMenu masterView:self.
@@ -823,6 +825,41 @@
 
 !PullDownMenu methodsFor:'event handling'!
 
+keyPress:key x:x y:y
+    |index m|
+
+    "
+     handle CursorLeft/Right for non-mouse operation
+     (once it has the explicit focus)
+    "
+    ((key == #CursorRight) or:[key == #CursorLeft]) ifTrue:[
+	activeMenuNumber isNil ifTrue:[
+	    index := (key == #CursorRight) ifTrue:[1] ifFalse:[menus size].
+	] ifFalse:[
+	    (key == #CursorRight) ifTrue:[
+		index := activeMenuNumber+1
+	    ] ifFalse:[
+		index := activeMenuNumber-1
+	    ].
+	    index == 0 ifTrue:[index := menus size]
+	    ifFalse:[
+		index > menus size ifTrue:[index := 1]
+	    ]
+	].
+	m := self pullMenu:index.
+	^ self
+    ].
+
+    activeMenuNumber isNil ifTrue:[^self].
+
+    "
+     pass it on to the active menu
+    "
+    m := menus at:activeMenuNumber.
+    m keyPress:key x:0 y:0.
+    ^ self
+!
+
 buttonPress:button x:x y:y
     |titleIndex activeMenu activeLeft activeTop m|