--- a/DSVColumnView.st Fri Jun 18 22:37:38 1999 +0200
+++ b/DSVColumnView.st Sat Jun 19 12:23:36 1999 +0200
@@ -27,7 +27,7 @@
checkToggleActiveImage checkTogglePassiveImage checkToggleLevel
comboButtonExtent comboButtonForm comboButtonLevel clickPosition
dragAccessPoint dragIsActive dropTarget dropSource columnAdaptor
- dataSetView'
+ dataSetView tabAtEndAction tabAtStartAction'
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
DefaultHilightForegroundColor DefaultHilightBackgroundColor
RowSelector ButtonLightColor ButtonShadowColor
@@ -689,6 +689,26 @@
rowIfAbsentBlock := aOneArgAction
+!
+
+tabAtEndAction:aNoneArgAction
+ "set the action, called without any argument at end of the list entering
+ tab next.
+ The default is to give the focus to the view after self in the focusSequence
+ "
+ tabAtEndAction := aNoneArgAction
+
+
+!
+
+tabAtStartAction:aNoneArgAction
+ "set the action, called without any argument at start of the list entering
+ tab previous.
+ The default is to give the focus to the view before self in the focusSequence
+ "
+ tabAtStartAction := aNoneArgAction
+
+
! !
!DSVColumnView methodsFor:'accessing behavior'!
@@ -2122,11 +2142,14 @@
#BeginOfText #EndOfText #ScrollUp #ScrollDown
#CursorUp #CursorDown #CursorRight #CursorLeft)>
- |sensor n max idx selRowNr key column|
+ |sensor n max idx selRowNr key column isTab listSize noSel|
(sensor := self sensor) isNil ifTrue:[
^ self
].
+ (listSize := list size) == 0 ifTrue:[
+ ^ super keyPress:aKey x:x y:y
+ ].
(aKey == #PreviousPage) ifTrue:[^ self pageUp].
(aKey == #NextPage) ifTrue:[^ self pageDown].
@@ -2138,67 +2161,67 @@
(aKey == #ScrollUp or:[aKey == #ScrollDown]) ifTrue:[
n := (1 + (sensor compressKeyPressEventsWithKey:aKey)) * self verticalScrollStep.
-
- aKey == #ScrollUp ifTrue:[self scrollUp:n]
- ifFalse:[self scrollDown:n].
- ^ self
+ aKey == #ScrollUp ifTrue:[self scrollUp:n] ifFalse:[self scrollDown:n].
+ ^ self
].
- self numberOfSelections == 1 ifFalse:[
- super keyPress:aKey x:x y:y.
- ^ self
- ].
- selRowNr := self firstIndexSelected.
-
aKey == #Return ifTrue:[
- ^ self doubleClicked
+ self numberOfSelections == 1 ifTrue:[self doubleClicked].
+ ^ self
].
+ selRowNr := self firstIndexSelected.
+ n := 1 + (sensor compressKeyPressEventsWithKey:aKey).
(aKey == #CursorUp or:[aKey == #CursorDown]) ifTrue:[
- max := self size.
-
- (n := (1 + (sensor compressKeyPressEventsWithKey:aKey)) \\ max) ~~ 0 ifTrue:[
+ selRowNr == 0 ifTrue:[
+ n := aKey == #CursorUp ifTrue:[listSize] ifFalse:[1]
+ ] ifFalse:[
+ n := (n \\ listSize) max:1.
+
aKey == #CursorUp ifTrue:[
- (n := selRowNr - n) <= 0 ifTrue:[n := max + n]
+ (n := selRowNr - n) <= 0 ifTrue:[n := listSize + n]
] ifFalse:[
- (n := selRowNr + n) > max ifTrue:[n := n - max]
- ].
- self selectColIndex:selectedColIndex rowIndex:n
+ (n := selRowNr + n) > listSize ifTrue:[n := n - listSize]
+ ]
].
- ^ self
+ ^ self selectColIndex:selectedColIndex rowIndex:n
].
-
- aKey == #focusPrevious ifTrue:[
- key := #CursorLeft
- ].
-
- aKey == #Tab ifTrue:[
- key := sensor shiftDown ifTrue:[#CursorLeft] ifFalse:[#CursorRight]
+ (isTab := aKey includesString:'Tab') ifTrue:[
+ key := (sensor shiftDown or:[aKey includesString:'Left']) ifTrue:[#CursorLeft]
+ ifFalse:[#CursorRight]
] ifFalse:[
- (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[
- ^ super keyPress:aKey x:x y:y
- ].
- key := aKey
+ (aKey == #focusPrevious or:[aKey == #focusNext]) ifTrue:[
+ isTab := true.
+ key := aKey == #focusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]
+ ] ifFalse:[
+ (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[
+ ^ super keyPress:aKey x:x y:y
+ ].
+ key := aKey
+ ]
].
-
- selectedColIndex == 0 ifTrue:[ "/ line is selected
- ^ self
+ max := self numberOfColumns.
+ selRowNr == 0 ifTrue:[selRowNr := 1].
+
+ (idx := selectedColIndex) == 0 ifTrue:[
+ idx := key == #CursorRight ifTrue:[0] ifFalse:[max + 1]
].
- n := 1 + (sensor compressKeyPressEventsWithKey:key).
- idx := selectedColIndex.
- max := self numberOfColumns.
-
key == #CursorLeft ifTrue:[
[n ~~ 0] whileTrue:[
(idx := idx - 1) == 0 ifTrue:[
- (aKey == #Tab and:[selRowNr > 1]) ifTrue:[
- selRowNr := selRowNr - 1
+ (isTab and:[(selRowNr := selRowNr - 1) == 0]) ifTrue:[
+ tabAtStartAction notNil ifTrue:[
+ tabAtStartAction value
+ ] ifFalse:[
+ self windowGroup focusPreviousFrom:self
+ ].
+ ^ self
].
idx := max
].
-
column := self columnAt:idx.
+
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
n := n - 1
]
@@ -2206,13 +2229,18 @@
] ifFalse:[
[n ~~ 0] whileTrue:[
(idx := idx + 1) > max ifTrue:[
- (aKey == #Tab and:[selRowNr < self size]) ifTrue:[
- selRowNr := selRowNr + 1
+ (isTab and:[(selRowNr := selRowNr + 1) > listSize]) ifTrue:[
+ tabAtEndAction notNil ifTrue:[
+ tabAtEndAction value
+ ] ifFalse:[
+ self windowGroup focusNextFrom:self
+ ].
+ ^ self
].
idx := 1
].
-
column := self columnAt:idx.
+
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
n := n - 1
]
@@ -2221,6 +2249,7 @@
self selectColIndex:idx rowIndex:selRowNr.
+
!
originChanged:delta
@@ -3339,5 +3368,5 @@
!DSVColumnView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.76 1999-06-11 17:22:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.77 1999-06-19 10:23:36 cg Exp $'
! !