--- a/DialogBox.st Fri Oct 07 15:56:28 2011 +0200
+++ b/DialogBox.st Tue Nov 08 12:17:04 2011 +0100
@@ -5075,6 +5075,64 @@
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
+ initialSelection:initialListSelectionOrNil
+ buttons:buttonLabels values:buttonValues
+ default:defaultValue
+ lines:maxLines width:nil
+ cancel:cancelBlock
+ multiple:multiple
+ title:windowTitle
+ postBuildBlock:aBlockOrNil
+
+ "
+ full example:
+
+ Transcript showCR:(
+ Dialog
+ choose:'choose any'
+ fromList:#('one' 'two' 'three' 'four') values:#(1 2 3 4)
+ initialSelection: nil
+ buttons:#('five' 'six' 'seven') values:#(5 6 7)
+ default:6
+ lines:10
+ cancel:nil
+ multiple:true
+ postBuildBlock: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
+ multiple:true
+ )
+ "
+
+ "Created: / 22-08-2006 / 16:10:19 / cg"
+!
+
+choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues default:defaultValue lines:maxLines width:boxWidthOrNil cancel:cancelBlock multiple:multiple title:windowTitle 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
+ from listValues is returned (doubleclick works as well).
+ The list may be suppressed (if the list arg is nil).
+ If a list is present, multiple controls if multiple selections are allowed.
+ 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."
+
|box listView panel sel haveDefault|
box := Dialog new.
@@ -5164,8 +5222,12 @@
windowTitle notNil ifTrue:[
box label:windowTitle.
].
- box width < 250 ifTrue:[
- box width:250.
+ boxWidthOrNil notNil ifTrue:[
+ box width:(boxWidthOrNil max:250).
+ ] ifFalse:[
+ box width < 250 ifTrue:[
+ box width:250.
+ ]
].
self showBox:box.
@@ -5216,7 +5278,7 @@
)
"
- "Created: / 22-08-2006 / 16:10:19 / cg"
+ "Created: / 08-11-2011 / 12:15:20 / cg"
!
choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple postBuildBlock:aBlockOrNil
@@ -9593,11 +9655,11 @@
!DialogBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.317 2011-09-07 10:52:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.318 2011-11-08 11:17:04 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.317 2011-09-07 10:52:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.318 2011-11-08 11:17:04 cg Exp $'
! !
DialogBox initialize!