crsrLeft/right behavior changed rel4_1_3_1
authorClaus Gittinger <cg@exept.de>
Wed, 12 Dec 2001 17:01:01 +0100
changeset 2065 845bd5d2523c
parent 2064 0e0d1fe431fb
child 2066 06618ad5f49f
crsrLeft/right behavior changed
SelectionInTreeView.st
--- a/SelectionInTreeView.st	Wed Dec 12 16:18:27 2001 +0100
+++ b/SelectionInTreeView.st	Wed Dec 12 17:01:01 2001 +0100
@@ -1447,25 +1447,37 @@
         ^ self
     ].
 
-    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
-        (idx := self selectedIndex) == 0 ifTrue:[ ^ self ].
-
-        (key == #CursorLeft) ifTrue:[ inc := -1. end := 0 ]
-                            ifFalse:[ inc :=  1. end := 1 + listOfNodes size ].
-
-        [(idx := idx + inc) ~~ end] whileTrue:[
-            node := listOfNodes at:idx.
-            node hasChildren ifTrue:[
-                ^ self key:key select:idx x:x y:y
-            ]
+    "/ cg: its nicer to expand/collaps on these keys
+    key == #CursorRight ifTrue:[
+        (node := self selectedNode) notNil ifTrue:[
+            model doExpand:node.
+            ^ self.
+        ].
+    ].
+    key == #CursorLeft ifTrue:[
+        (node := self selectedNode) notNil ifTrue:[
+            model doCollapse:node.
+            ^ self.
         ].
-        ^ self
     ].
+
+    "/ search fwd/bwd for a node with children
+
+"/    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
+"/        (idx := self selectedIndex) == 0 ifTrue:[ ^ self ].
+"/
+"/        (key == #CursorLeft) ifTrue:[ inc := -1. end := 0 ]
+"/                            ifFalse:[ inc :=  1. end := 1 + listOfNodes size ].
+"/
+"/        [(idx := idx + inc) ~~ end] whileTrue:[
+"/            node := listOfNodes at:idx.
+"/            node hasChildren ifTrue:[
+"/                ^ self key:key select:idx x:x y:y
+"/            ]
+"/        ].
+"/        ^ self
+"/    ].
     ^ super keyPress:key x:x y:y
-
-
-
-
 ! !
 
 !SelectionInTreeView methodsFor:'initialize / release'!
@@ -2468,5 +2480,5 @@
 !SelectionInTreeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.96 2001-11-19 15:28:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.97 2001-12-12 16:01:01 cg Exp $'
 ! !