when the last child is removed,
authorClaus Gittinger <cg@exept.de>
Thu, 06 Oct 2005 13:52:05 +0200
changeset 2853 e852742cbd10
parent 2852 c5651fcf9770
child 2854 20b890ba0f6c
when the last child is removed, clear the isExpanded flag. (looks ugly, because the [-] icon is no longer shown, and the item cannot be compressed again).
HierarchicalItem.st
--- a/HierarchicalItem.st	Thu Oct 06 12:58:18 2005 +0200
+++ b/HierarchicalItem.st	Thu Oct 06 13:52:05 2005 +0200
@@ -616,17 +616,21 @@
     "remove the children from startIndex up to and including
      the child under stopIndex.
     "
-    |noChildren stop|
+    |nrOfChildren stop|
 
-    noChildren := children size.
+    nrOfChildren := children size.
 
-    (startIndex <= stopIndex and:[startIndex <= noChildren]) ifTrue:[
-        stop := stopIndex min:noChildren.
+    (startIndex <= stopIndex and:[startIndex <= nrOfChildren]) ifTrue:[
+        stop := stopIndex min:nrOfChildren.
         
         self criticalDo:[
             self basicRemoveFromIndex:startIndex toIndex:stop
         ]
     ].
+
+    children size == 0 ifTrue:[
+        isExpanded := false.
+    ].
 !
 
 removeIndex:anIndex
@@ -1893,5 +1897,5 @@
 !HierarchicalItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalItem.st,v 1.72 2005-10-05 12:14:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalItem.st,v 1.73 2005-10-06 11:52:05 cg Exp $'
 ! !