MultiSelectionInList.st
changeset 1413 e00159f1414d
parent 1410 80332bbccffc
child 2724 23f4e16dc4f4
--- a/MultiSelectionInList.st	Wed Jan 14 16:16:04 1998 +0100
+++ b/MultiSelectionInList.st	Wed Jan 14 16:17:01 1998 +0100
@@ -48,15 +48,15 @@
 selection
     "return the selections value (i.e. the entry numbers in the list)"
 
-    |l|
-
-    l := self list.
-    l isNil ifTrue:[^ self zeroIndex].    "/ mhmh - no list; what should we do here ?
+    |l s|
 
-    ^ selectionIndexHolder value 
-        collect:[:index |
-            l at:index
-        ]
+    (     (l := self list) isNil                                "/ mhmh - no list; what should we do here ?
+      or:[(s := selectionIndexHolder value) size == 0]          "/ mhmh - can be nil ?
+    ) ifTrue:[
+        ^ self zeroIndex
+    ].
+
+    ^ s collect:[:index | l at:index ]
 
     "Created: 26.10.1995 / 16:52:27 / cg"
     "Modified: 20.4.1996 / 13:14:29 / cg"
@@ -125,6 +125,13 @@
 
 !MultiSelectionInList methodsFor:'queries'!
 
+numberOfSelections
+    "return the number of selected entries
+    "
+    ^ selectionIndexHolder value size
+
+!
+
 zeroIndex
     "return the selectionIndex returned when nothing is selected.
      Here, an empty collection is returned."
@@ -185,5 +192,5 @@
 !MultiSelectionInList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.15 1998-01-02 16:05:11 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/MultiSelectionInList.st,v 1.16 1998-01-14 15:17:01 ca Exp $'
 ! !