class: DialogBox
authorClaus Gittinger <cg@exept.de>
Sun, 10 Mar 2013 21:22:12 +0100
changeset 4530 145d69b4c4d4
parent 4529 ec75c190f714
child 4531 6560654209a1
class: DialogBox changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock: fix for the case where a button is added as return-button in the pre-open block. (did still execute the default action)
DialogBox.st
--- a/DialogBox.st	Sat Mar 09 00:52:33 2013 +0100
+++ b/DialogBox.st	Sun Mar 10 21:22:12 2013 +0100
@@ -5232,17 +5232,25 @@
 "/        ].
         listView list:list.
         listView doubleClickAction:[:selectionIndex | 
-            |val|
+            |val okButton|
 
             multiple ifTrue:[
                 val := selectionIndex collect:[:idx | listValues at:idx].
             ] ifFalse:[
                 val := listValues at:selectionIndex.
             ].
-            box destroy. 
+            (box okButton notNil and:[box okButton isReturnButton]) ifTrue:[
+                box destroy. 
+            ] ifFalse:[
+                okButton := box allSubViewsDetect:[:v | v isDefault] ifNone:nil.
+                okButton notNil ifTrue:[
+                    okButton controller performAction
+                ]
+            ].
             ^ val
         ].
         listView multipleSelectOk:multiple.
+
         initialListSelectionOrNil notNil ifTrue:[
             multiple ifTrue:[
                 listView selection:(initialListSelectionOrNil collect:[:each| listValues indexOf:each])
@@ -5324,6 +5332,7 @@
     ].
 
     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)
 
@@ -9774,11 +9783,11 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.331 2013-02-08 20:30:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.332 2013-03-10 20:22:12 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.331 2013-02-08 20:30:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.332 2013-03-10 20:22:12 cg Exp $'
 ! !