SelectionInListView.st
changeset 5664 a8ecef1ff7e2
parent 5663 4e9d4fa76738
child 5665 a28ccea0dc36
child 5666 cb5ef2978993
equal deleted inserted replaced
5663:4e9d4fa76738 5664:a8ecef1ff7e2
  2484      allowed, this adds/removes the new item to the selection."
  2484      allowed, this adds/removes the new item to the selection."
  2485 
  2485 
  2486     |oldSelection|
  2486     |oldSelection|
  2487 
  2487 
  2488     enabled ifFalse:[
  2488     enabled ifFalse:[
  2489         ^ self
  2489         ^ false
  2490     ].
  2490     ].
  2491 
  2491 
  2492     keyActionStyle notNil ifTrue:[
  2492     keyActionStyle isNil ifTrue:[^ false].
  2493         "/ this item selectable ?
  2493     
  2494         (selectConditionBlock notNil 
  2494     "/ this item selectable ?
  2495          and:[(selectConditionBlock value:index) not]) ifTrue:[^ self].
  2495     (selectConditionBlock notNil 
  2496 
  2496      and:[(selectConditionBlock value:index) not]) ifTrue:[^ false].
  2497         keyActionStyle == #pass ifTrue:[
  2497 
  2498             ^ super keyPress:key x:x y:y
  2498     keyActionStyle == #pass ifTrue:[
  2499         ].
  2499         super keyPress:key x:x y:y.
  2500 
  2500         ^ false.
  2501         (self multipleSelectOk and:[shifted]) ifTrue:[
  2501     ].
  2502             oldSelection := selection copy.
  2502 
  2503             (self isInSelection:index) ifTrue:[
  2503     (self multipleSelectOk and:[shifted]) ifTrue:[
  2504                 self removeFromSelection:index
  2504         oldSelection := selection copy.
  2505             ] ifFalse:[
  2505         (self isInSelection:index) ifTrue:[
  2506                 self addToSelection:index.
  2506             self removeFromSelection:index
  2507                 self makeLineVisible:index.
       
  2508             ].
       
  2509             (selection ~= oldSelection) ifTrue:[
       
  2510                 self selectionChangedFrom:oldSelection.
       
  2511             ].
       
  2512         ] ifFalse:[
  2507         ] ifFalse:[
  2513             self multipleSelectOk ifTrue:[
  2508             self addToSelection:index.
  2514                 self selection:(OrderedCollection with:index)
  2509             self makeLineVisible:index.
  2515             ] ifFalse:[
  2510         ].
  2516                 self selection:index.
  2511         (selection ~= oldSelection) ifTrue:[
  2517             ].    
  2512             self selectionChangedFrom:oldSelection.
  2518             keyActionStyle == #selectAndDoubleClick ifTrue:[
  2513         ].
  2519                 self doubleClicked
  2514     ] ifFalse:[
  2520             ]
  2515         self multipleSelectOk ifTrue:[
       
  2516             self selection:(OrderedCollection with:index)
       
  2517         ] ifFalse:[
       
  2518             self selection:index.
       
  2519         ].    
       
  2520         keyActionStyle == #selectAndDoubleClick ifTrue:[
       
  2521             self doubleClicked
  2521         ]
  2522         ]
  2522     ].
  2523     ].
       
  2524     ^ true
  2523 
  2525 
  2524     "Modified: / 4.2.2000 / 14:51:25 / cg"
  2526     "Modified: / 4.2.2000 / 14:51:25 / cg"
  2525 !
  2527 !
  2526 
  2528 
  2527 keyPress:key x:x y:y
  2529 keyPress:key x:x y:y
  2676             [true] whileTrue:[
  2678             [true] whileTrue:[
  2677                 s := self characterSearchItemStringAt:searchIndex.
  2679                 s := self characterSearchItemStringAt:searchIndex.
  2678                 s notNil ifTrue:[
  2680                 s notNil ifTrue:[
  2679                     (s string withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[
  2681                     (s string withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[
  2680                         searchIndex = selection ifTrue:[^ self].
  2682                         searchIndex = selection ifTrue:[^ self].
  2681                         ^ self key:key select:searchIndex x:x y:y shifted:false
  2683                         (selectConditionBlock isNil or:[(selectConditionBlock value:searchIndex)]) ifTrue:[
       
  2684                             ^ self key:key select:searchIndex x:x y:y shifted:false
       
  2685                         ].
  2682                     ].
  2686                     ].
  2683                 ].
  2687                 ].
  2684                 backSearch ifTrue:[
  2688                 backSearch ifTrue:[
  2685                     searchIndex := searchIndex - 1.
  2689                     searchIndex := searchIndex - 1.
  2686                     searchIndex < 1 ifTrue:[searchIndex := mySize]
  2690                     searchIndex < 1 ifTrue:[searchIndex := mySize]