--- a/DSVColumnView.st Thu Jul 13 07:42:04 2000 +0200
+++ b/DSVColumnView.st Mon Jul 17 09:56:33 2000 +0200
@@ -2035,7 +2035,7 @@
#BeginOfText #EndOfText #ScrollUp #ScrollDown
#CursorUp #CursorDown #CursorRight #CursorLeft)>
- |sensor n maxColNr idx selRowNr key column isTab listSize noSel hasSelectables|
+ |sensor maxColNr selRowNr selColNr key column isTab listSize hasSelectables|
(sensor := self sensor) isNil ifTrue:[
^ self
@@ -2043,21 +2043,19 @@
(listSize := list size) == 0 ifTrue:[
^ super keyPress:aKey x:x y:y
].
-
- (aKey == #PreviousPage) ifTrue:[^ self pageUp].
- (aKey == #NextPage) ifTrue:[^ self pageDown].
- (aKey == #HalfPageUp) ifTrue:[^ self halfPageUp].
- (aKey == #HalfPageDown) ifTrue:[^ self halfPageDown].
- (aKey == #BeginOfText) ifTrue:[^ self scrollToTop].
- (aKey == #EndOfText) ifTrue:[^ self scrollToBottom].
- (aKey isCharacter) ifTrue:[^ self characterPress:aKey x:x y:y ].
-
- (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 isCharacter ifTrue:[
+ ^ self characterPress:aKey x:x y:y
].
+ aKey == #PreviousPage ifTrue:[^ self pageUp].
+ aKey == #NextPage ifTrue:[^ self pageDown].
+ aKey == #HalfPageUp ifTrue:[^ self halfPageUp].
+ aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
+ aKey == #BeginOfText ifTrue:[^ self scrollToTop].
+ aKey == #EndOfText ifTrue:[^ self scrollToBottom].
+ aKey == #ScrollUp ifTrue:[^ self scrollUp].
+ aKey == #ScrollDown ifTrue:[^ self scrollDown].
+
aKey == #Return ifTrue:[
self numberOfSelections == 1 ifTrue:[self doubleClicked].
^ self
@@ -2070,28 +2068,28 @@
hasSelectables := aCol description canSelect
]
].
+ selRowNr := self firstIndexSelected.
+
+ (aKey == #CursorUp or:[aKey == #CursorDown]) ifTrue:[
+ (hasSelectables or:[selectRowOnDefault]) ifTrue:[
+ selColNr := hasSelectables ifFalse:[0]
+ ifTrue:[selectedColIndex].
+
+ aKey == #CursorUp ifTrue:[
+ selRowNr := selRowNr > 1 ifTrue:[selRowNr - 1] ifFalse:[listSize].
+ ] ifFalse:[
+ selRowNr := selRowNr < listSize ifTrue:[selRowNr + 1] ifFalse:[1].
+ ].
+ self selectColIndex:selColNr rowIndex:selRowNr
+ ].
+ ^ self
+ ].
hasSelectables ifFalse:[
^ super keyPress:aKey x:x y:y
].
- selRowNr := self firstIndexSelected.
- n := 1 + (sensor compressKeyPressEventsWithKey:aKey).
- (aKey == #CursorUp or:[aKey == #CursorDown]) 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 := listSize + n]
- ] ifFalse:[
- (n := selRowNr + n) > listSize ifTrue:[n := n - listSize]
- ]
- ].
- ^ self selectColIndex:selectedColIndex rowIndex:n
- ].
-
+ "/ CURSOR LEFT/RIGHT or TABING
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifFalse:[
tabIntern ifFalse:[
^ super keyPress:aKey x:x y:y
@@ -2113,15 +2111,14 @@
].
maxColNr := self numberOfColumns.
- idx := selectedColIndex.
+ selColNr := selectedColIndex.
key == #CursorLeft ifTrue:[
selRowNr == 0 ifTrue:[selRowNr := listSize].
- idx == 0 ifTrue:[idx := maxColNr + 1].
-
- [n ~~ 0] whileTrue:[
- idx := idx - 1.
- idx == 0 ifTrue:[
+ selColNr == 0 ifTrue:[selColNr := maxColNr + 1].
+
+ [true] whileTrue:[
+ (selColNr := selColNr - 1) == 0 ifTrue:[
(selRowNr := selRowNr - 1) == 0 ifTrue:[
isTab ifTrue:[
tabAtStartAction notNil ifTrue:[
@@ -2133,42 +2130,39 @@
].
^ self
].
- idx := maxColNr
+ selColNr := maxColNr
].
- column := self columnAt:idx.
+ column := self columnAt:selColNr.
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
- n := n - 1
- ]
- ]
- ] ifFalse:[
- selRowNr == 0 ifTrue:[selRowNr := 1].
-
- [n ~~ 0] whileTrue:[
- idx := idx + 1.
-
- idx > maxColNr ifTrue:[
- (selRowNr := selRowNr + 1) > listSize ifTrue:[
- isTab ifTrue:[
- tabAtEndAction notNil ifTrue:[
- tabAtEndAction value
- ] ifFalse:[
- self deselect.
- self windowGroup focusNextFrom:self
- ]
- ].
- ^ self
- ].
- idx := 1
- ].
- column := self columnAt:idx.
-
- (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
- n := n - 1
+ ^ self selectColIndex:selColNr rowIndex:selRowNr.
]
]
].
- self selectColIndex:idx rowIndex:selRowNr.
+
+ selRowNr == 0 ifTrue:[selRowNr := 1].
+
+ [true] whileTrue:[
+ (selColNr := selColNr + 1) > maxColNr ifTrue:[
+ (selRowNr := selRowNr + 1) > listSize ifTrue:[
+ isTab ifTrue:[
+ tabAtEndAction notNil ifTrue:[
+ tabAtEndAction value
+ ] ifFalse:[
+ self deselect.
+ self windowGroup focusNextFrom:self
+ ]
+ ].
+ ^ self
+ ].
+ selColNr := 1
+ ].
+ column := self columnAt:selColNr.
+
+ (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
+ ^ self selectColIndex:selColNr rowIndex:selRowNr
+ ]
+ ].
@@ -3395,5 +3389,5 @@
!DSVColumnView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.105 2000-04-05 08:53:28 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.106 2000-07-17 07:56:33 ca Exp $'
! !