DialogBox.st
changeset 4330 9207417a6965
parent 4329 242be44c97ef
child 4331 ee5133add66d
--- a/DialogBox.st	Tue Nov 08 12:17:04 2011 +0100
+++ b/DialogBox.st	Tue Nov 08 13:30:03 2011 +0100
@@ -5181,13 +5181,20 @@
 
             b := Button label:label.
             b action:[
-                |val|
+                |val selectionValues|
+
+                selectionValues := listValues isNil 
+                                        ifTrue:[ listView selection ]
+                                        ifFalse:[ listView selection collect:[:idx | listValues at:idx]].
                 val := buttonValues at:index.
-                val isBlock ifTrue:[ val := val valueWithOptionalArgument:listView selection and:box].
+                val isBlock ifTrue:[ 
+                    val := val valueWithOptionalArgument:selectionValues and:box
+                ] ifFalse:[
+                    multiple ifTrue:[
+                        val := Array with:val
+                    ].
+                ].
                 box destroy. 
-                multiple ifTrue:[
-                    ^ Array with:val
-                ].
                 ^ val
             ].
             haveDefault ifFalse:[
@@ -5231,6 +5238,8 @@
     ].
 
     self showBox:box.
+    "/ notice: if one of the extra buttons is pressed, we do not arrive here, and the returned value
+    "/ is the value returned by the button-value (which might be a block)
 
     box accepted ifTrue:[
         (sel := listView selection) notNil ifTrue:[
@@ -9655,11 +9664,11 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.318 2011-11-08 11:17:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.319 2011-11-08 12:30:03 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.318 2011-11-08 11:17:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.319 2011-11-08 12:30:03 cg Exp $'
 ! !
 
 DialogBox initialize!