PullDownMenu.st
changeset 513 97fe3c60042b
parent 491 7b376aaa06d5
child 516 656a8f993435
--- a/PullDownMenu.st	Thu Mar 21 17:58:29 1996 +0100
+++ b/PullDownMenu.st	Fri Mar 22 15:38:51 1996 +0100
@@ -895,7 +895,7 @@
 
     <resource: #keyboard (#CursorLeft #CursorRight #MenuSelect)>
 
-    |index m sel|
+    |index startIndex m sel|
 
     "
      handle CursorLeft/Right for non-mouse operation
@@ -920,7 +920,44 @@
         ^ self
     ].
 
-    activeMenuNumber isNil ifTrue:[^ super keyPress:key x:x y:y].
+"/    activeMenuNumber isNil ifTrue:[
+        "/
+        "/ find an item starting with that alpha-key
+        "/
+        key isCharacter ifTrue:[
+            (key isLetter) ifTrue:[
+                activeMenuNumber isNil ifTrue:[
+                    startIndex := 1.
+                ] ifFalse:[
+                    startIndex := activeMenuNumber + 1
+                ].
+                index := titles 
+                            findFirst:[:item | 
+                                            item isString
+                                            and:[(item startsWith:key asUppercase)
+                                                 or:[item startsWith:key asLowercase]]]
+                            startingAt:startIndex.
+
+                (index == 0 and:[startIndex ~~ 1]) ifTrue:[
+                    index := titles 
+                                findFirst:[:item | 
+                                                item isString
+                                                and:[(item startsWith:key asUppercase)
+                                                     or:[item startsWith:key asLowercase]]]
+                                startingAt:1.
+                ].
+
+                index ~~ 0 ifTrue:[
+                    self pullMenu:index.
+                ].
+                ^ self
+            ]
+        ].
+"/    ].
+
+    activeMenuNumber isNil ifTrue:[
+        ^ super keyPress:key x:x y:y
+    ].
 
     "
      Return, space or the (virtual) MenuSelect key trigger
@@ -942,7 +979,7 @@
         m keyPress:key x:0 y:0.
     ].
 
-    "Modified: 7.3.1996 / 13:18:04 / cg"
+    "Modified: 22.3.1996 / 15:37:30 / cg"
 !
 
 showNoFocus:explicit
@@ -1344,5 +1381,5 @@
 !PullDownMenu class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.41 1996-03-07 12:56:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/PullDownMenu.st,v 1.42 1996-03-22 14:38:51 cg Exp $'
 ! !