if after collapse no selection exists, use the collapsed element
authorca
Sat, 28 Sep 2002 07:15:33 +0200
changeset 1610 cb3e093aa6d5
parent 1609 3ebd61486dc9
child 1611 2f23751929d6
if after collapse no selection exists, use the collapsed element
MenuEditor.st
--- a/MenuEditor.st	Wed Sep 25 09:28:50 2002 +0200
+++ b/MenuEditor.st	Sat Sep 28 07:15:33 2002 +0200
@@ -1324,7 +1324,12 @@
     |item|
 
     item := listOfItems at:atLine ifAbsent:nil.
-    item ifNotNil:[ item toggleExpand ].
+    item ifNotNil:[
+        item toggleExpand.
+        self hasSelection ifFalse:[
+            self selectedItem:item
+        ]
+    ].
 ! !
 
 !MenuEditor methodsFor:'aspects'!
@@ -1871,6 +1876,12 @@
     ^ self askForItemModification
 !
 
+hasSelection
+    "returns true if a selection exists
+    "
+    ^ selectionHolder value size ~~ 0
+!
+
 selectedItem
     "returns the selected item or nil (none or multiple selected)
     "