change events for CursorRight
authorpenk
Fri, 27 Sep 2002 14:16:14 +0200
changeset 2227 c5e6912cc6b2
parent 2226 4478e2919bd2
child 2228 5268b9c3be4a
change events for CursorRight
HierarchicalListView.st
--- a/HierarchicalListView.st	Fri Sep 27 14:09:42 2002 +0200
+++ b/HierarchicalListView.st	Fri Sep 27 14:16:14 2002 +0200
@@ -998,7 +998,7 @@
     "
     <resource: #keyboard( #CursorLeft #CursorRight )>
 
-    |item parent index size stop step|
+    |item index|
 
     enabled ifFalse:[^ self].
     index := self selectedIndex.
@@ -1012,46 +1012,24 @@
         index ~~ 0 ifTrue:[
             item := list at:index ifAbsent:nil.
             item notNil ifTrue:[
-"/                (((aKey == #CursorRight) and:[item isExpanded not]) 
-"/                or:[((aKey == #CursorLeft) and:[item isExpanded])]) ifTrue:[
                 (aKey == #CursorLeft) == (item isExpanded) ifTrue:[
                     ^ self indicatorPressedAt:index
                 ] ifFalse:[
                     aKey == #CursorLeft ifTrue:[
                         self selectElement:item parent ifAbsent:[].
                         ^ self.
+                    ] ifFalse:[
+                        " select the childrens first item on CursorLeft
+                          if there are any"
+                        item hasChildren ifTrue:[
+                            self selection:(index + 1)
+                        ].
+                        ^ self.
                     ].
                 ].
             ]
         ]
     ].
-
-"/    (aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[
-"/        
-"/    
-"/
-"/        (     enabled
-"/         and:[(size  := list size) > 1
-"/         and:[(index := self selectedIndex) ~~ 0
-"/         and:[(item  := list at:index ifAbsent:nil) notNil]]]
-"/        ) ifTrue:[
-"/            parent := item parent.
-"/
-"/            aKey == #CursorLeft ifTrue:[step := -1. stop :=    1]
-"/                               ifFalse:[step :=  1. stop := size].    
-"/
-"/            (index + step) to:stop by:step do:[:i|
-"/                item := list at:i ifAbsent:nil.
-"/                item isNil ifTrue:[^ nil].
-"/                item parent ~~ parent ifTrue:[^ self selection:i]
-"/            ].
-"/
-"/            index := aKey == #CursorLeft ifTrue:[size] ifFalse:[1].
-"/            self selection:index
-"/        ].
-"/        ^ self
-"/    ].
-
     ^ super keyPress:aKey x:x y:y
 ! !
 
@@ -1437,5 +1415,5 @@
 !HierarchicalListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.48 2002-09-27 11:32:55 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.49 2002-09-27 12:16:14 penk Exp $'
 ! !