# HG changeset patch # User Claus Gittinger # Date 1008172861 -3600 # Node ID 845bd5d2523c7c3bcc0539addd5cb35b8c58e776 # Parent 0e0d1fe431fbd4fa6f06ac1c95f19136826543fd crsrLeft/right behavior changed diff -r 0e0d1fe431fb -r 845bd5d2523c 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 $' ! !