added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
authorClaus Gittinger <cg@exept.de>
Mon, 02 Nov 2009 12:25:05 +0100
changeset 4058 6c30a8f944f5
parent 4057 314415319f37
child 4059 aafb045f8dfc
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
DialogBox.st
--- a/DialogBox.st	Mon Nov 02 11:45:29 2009 +0100
+++ b/DialogBox.st	Mon Nov 02 12:25:05 2009 +0100
@@ -4513,6 +4513,102 @@
     "Modified: / 02-03-2007 / 12:08:02 / cg"
 !
 
+choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock postBuildBlock:postBuildBlock
+    "launch a Dialog showing the message and list.
+     The user can select an item and click ok; in this case, the corresponding value
+     from listValues is returned (doubleclick works as well). 
+     The list may be suppressed (if the list arg is nil).
+     Below the list, an optional row of buttons is shown, which can also be
+     clicked upon, and a corresponding value from buttonValues is returned.
+     If cancel is pressed, the value of cancelBlock is returned.
+     Pressing ok without a selection is treated like cancel."
+
+    ^ self
+        choose:aString 
+        fromList:list values:listValues 
+        buttons:buttonLabels values:buttonValues 
+        lines:maxLines 
+        cancel:cancelBlock 
+        multiple:false
+        postBuildBlock:postBuildBlock.
+
+
+    "
+     full example:
+
+         Transcript showCR:(
+             Dialog 
+                choose:'choose any' 
+                fromList:#('one' 'two' 'three' 'four') 
+                values:#(1 2 3 4) 
+                buttons:#('five' 'six' 'seven')
+                values:#(5 6 7)
+                lines:10 
+                cancel:nil
+         )
+
+
+     no buttons:
+
+         Transcript showCR:(
+             Dialog 
+                choose:'choose any' 
+                fromList:#('one' 'two' 'three' 'four') 
+                values:#(1 2 3 4) 
+                buttons:nil
+                values:nil
+                lines:4
+                cancel:nil
+         )
+
+
+     no list (lines argument is ignored):
+
+         Transcript showCR:(
+             Dialog 
+                choose:'choose any' 
+                fromList:nil
+                values:nil
+                buttons:#('one' 'two' 'three' 'four') 
+                values:#(1 2 3 4) 
+                lines:nil
+                cancel:nil
+         )
+
+
+      full including cancel value:
+
+         Transcript showCR:(
+             Dialog 
+                choose:'choose example' 
+                fromList:#('one' 'two' 'three' 'four') 
+                values:#(1 2 3 4) 
+                buttons:#('five' 'six' 'seven')
+                values:#(5 6 7)
+                lines:4
+                cancel:[Transcript flash. #aborted]
+         )
+
+
+     degenerated:
+
+         Transcript showCR:(
+             Dialog 
+                choose:'choose any' 
+                fromList:nil
+                values:nil
+                buttons:nil
+                values:nil
+                lines:nil 
+                cancel:nil
+         )
+
+
+    "
+
+    "Modified: / 02-03-2007 / 12:08:12 / cg"
+!
+
 choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues default:defaultValue lines:maxLines cancel:cancelBlock multiple:multiple postBuildBlock:aBlockOrNil
     "launch a Dialog showing the message and list.
      The user can select an item and click ok; in this case, the corresponding value
@@ -4637,6 +4733,7 @@
     windowTitle notNil ifTrue:[
         box label:windowTitle.
     ].
+
     self showBox:box.
 
     box accepted ifTrue:[
@@ -8900,7 +8997,11 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.290 2009-09-29 13:04:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.291 2009-11-02 11:25:05 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.291 2009-11-02 11:25:05 cg Exp $'
 ! !
 
 DialogBox initialize!