diff -r 43667474ed53 -r c71ff456e7ad PullDownMenu.st --- a/PullDownMenu.st Mon Feb 13 20:49:09 2017 +0100 +++ b/PullDownMenu.st Mon Feb 13 20:49:10 2017 +0100 @@ -1197,72 +1197,72 @@ These will pull the previous/next menu " ((key == #CursorRight) or:[key == #CursorLeft]) ifTrue:[ - activeMenuNumber isNil ifTrue:[ - index := (key == #CursorRight) ifTrue:[1] ifFalse:[menus size]. - ] ifFalse:[ - (key == #CursorRight) ifTrue:[ - "/ if its a cursor-right, and the current item - "/ has a submenu, then pop up the submenu - m := menus at:activeMenuNumber. - m notNil ifTrue:[ - m selectedItemHasSubmenu ifTrue:[ - m showSubmenu:(m selection). - ^ self. - ]. - ]. - ]. + activeMenuNumber isNil ifTrue:[ + index := (key == #CursorRight) ifTrue:[1] ifFalse:[menus size]. + ] ifFalse:[ + (key == #CursorRight) ifTrue:[ + "/ if it's a cursor-right, and the current item + "/ has a submenu, then pop up the submenu + m := menus at:activeMenuNumber. + m notNil ifTrue:[ + m selectedItemHasSubmenu ifTrue:[ + m showSubmenu:(m selection). + ^ self. + ]. + ]. + ]. - (key == #CursorRight) ifTrue:[ - index := activeMenuNumber+1 - ] ifFalse:[ - index := activeMenuNumber-1 - ]. - index == 0 ifTrue:[index := menus size] - ifFalse:[ - index > menus size ifTrue:[index := 1] - ] - ]. - self pullMenu:index. - ^ self + (key == #CursorRight) ifTrue:[ + index := activeMenuNumber+1 + ] ifFalse:[ + index := activeMenuNumber-1 + ]. + index == 0 ifTrue:[index := menus size] + ifFalse:[ + index > menus size ifTrue:[index := 1] + ] + ]. + self pullMenu:index. + ^ self ]. "/ 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. + "/ + "/ 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 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 - ] - ]. + index ~~ 0 ifTrue:[ + self pullMenu:index. + ]. + ^ self + ] + ]. "/ ]. activeMenuNumber isNil ifTrue:[ - ^ super keyPress:key x:x y:y + ^ super keyPress:key x:x y:y ]. " @@ -1273,16 +1273,17 @@ " m := menus at:activeMenuNumber. m isNil ifTrue:[ - (key == #Return - or:[key == #MenuSelect - or:[key == Character space]]) ifTrue:[ - self performSelectedAction. - ]. + (key == #Return + or:[key == #MenuSelect + or:[key == Character space]]) ifTrue:[ + self performSelectedAction. + ]. ] ifFalse:[ - m keyPress:key x:0 y:0. + m keyPress:key x:0 y:0. ]. - "Modified: 25.2.1997 / 23:38:15 / cg" + "Modified: / 25-02-1997 / 23:38:15 / cg" + "Modified (format): / 13-02-2017 / 20:29:32 / cg" ! showNoFocus:explicit