#UI_ENHANCEMENT by cg
class: SelectionInListView
changed:
#key:select:x:y:shifted:
#keyPress:x:y:
select next on keyPress must skip over disabled items
(variable list in browser, with grey class names)
--- a/SelectionInListView.st Thu Apr 14 12:53:44 2016 +0200
+++ b/SelectionInListView.st Thu Apr 14 19:51:43 2016 +0200
@@ -2486,40 +2486,42 @@
|oldSelection|
enabled ifFalse:[
- ^ self
+ ^ false
].
- keyActionStyle notNil ifTrue:[
- "/ this item selectable ?
- (selectConditionBlock notNil
- and:[(selectConditionBlock value:index) not]) ifTrue:[^ self].
-
- keyActionStyle == #pass ifTrue:[
- ^ super keyPress:key x:x y:y
+ keyActionStyle isNil ifTrue:[^ false].
+
+ "/ this item selectable ?
+ (selectConditionBlock notNil
+ and:[(selectConditionBlock value:index) not]) ifTrue:[^ false].
+
+ keyActionStyle == #pass ifTrue:[
+ super keyPress:key x:x y:y.
+ ^ false.
+ ].
+
+ (self multipleSelectOk and:[shifted]) ifTrue:[
+ oldSelection := selection copy.
+ (self isInSelection:index) ifTrue:[
+ self removeFromSelection:index
+ ] ifFalse:[
+ self addToSelection:index.
+ self makeLineVisible:index.
].
-
- (self multipleSelectOk and:[shifted]) ifTrue:[
- oldSelection := selection copy.
- (self isInSelection:index) ifTrue:[
- self removeFromSelection:index
- ] ifFalse:[
- self addToSelection:index.
- self makeLineVisible:index.
- ].
- (selection ~= oldSelection) ifTrue:[
- self selectionChangedFrom:oldSelection.
- ].
+ (selection ~= oldSelection) ifTrue:[
+ self selectionChangedFrom:oldSelection.
+ ].
+ ] ifFalse:[
+ self multipleSelectOk ifTrue:[
+ self selection:(OrderedCollection with:index)
] ifFalse:[
- self multipleSelectOk ifTrue:[
- self selection:(OrderedCollection with:index)
- ] ifFalse:[
- self selection:index.
- ].
- keyActionStyle == #selectAndDoubleClick ifTrue:[
- self doubleClicked
- ]
+ self selection:index.
+ ].
+ keyActionStyle == #selectAndDoubleClick ifTrue:[
+ self doubleClicked
]
].
+ ^ true
"Modified: / 4.2.2000 / 14:51:25 / cg"
!
@@ -2678,7 +2680,9 @@
s notNil ifTrue:[
(s string withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[
searchIndex = selection ifTrue:[^ self].
- ^ self key:key select:searchIndex x:x y:y shifted:false
+ (selectConditionBlock isNil or:[(selectConditionBlock value:searchIndex)]) ifTrue:[
+ ^ self key:key select:searchIndex x:x y:y shifted:false
+ ].
].
].
backSearch ifTrue:[