DialogBox.st
changeset 3906 75ca4638f79e
parent 3902 eb4576429ff0
child 3908 172d2e8ad328
--- a/DialogBox.st	Fri Sep 04 11:21:22 2009 +0200
+++ b/DialogBox.st	Fri Sep 04 11:22:05 2009 +0200
@@ -1746,20 +1746,22 @@
 
     ^ self
         confirmWithCancel:aString 
-        labels:buttonLabels values:buttonValues 
+        labels:buttonLabels 
+        values:buttonValues 
         default:default 
         title:boxLabelOrNil
 
     "Modified: / 02-03-2007 / 15:09:11 / cg"
 !
 
-confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default title:boxLabelOrNil
+confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default check:checkLabelOrNil on:checkHolderOrNil title:boxLabelOrNil
     "launch a Dialog, which allows user to click on any button.
      Return the corresponding value from the values array.
      The labels for for the buttons are to be passed in
      buttonLabels; 
-     The default argument (if non-nil) defines the index of the 
-     return button (1 to n)"
+     The default argument (if non-nil) defines the index of the return button (1 to n).
+     If checkLabel/checkHolder are not nil, and additional labelled checkBox is added to operate on
+     checkHolder. This can be used for 'do not show this box again' checkItems."
 
     |box buttons answer i|
 
@@ -1789,6 +1791,10 @@
             (buttons at:i) cursor:(Cursor thumbsDown).
         ]
     ].
+    checkLabelOrNil notNil ifTrue:[
+        box addCheckBox:checkLabelOrNil on:checkHolderOrNil.
+    ].
+
     self showAndThenDestroyBox:box.
     box actions:nil.
     ^ answer
@@ -1800,7 +1806,48 @@
             labels:#('mhmh' 'maybe' 'definitely')
             values:#(1 2 3)
             default:3
-            boxLabel:'hello there'
+            check:'Again' on:(true asValue)
+            title:'hello there'
+     )
+
+     Transcript showCR:(
+         Dialog 
+            confirmWithCancel:'really ?'
+            labels:#('mhmh' 'maybe' 'definitely')
+            values:#(1 2 3)
+            default:3
+            check:nil on:nil
+            title:'hello there'
+     )
+    "
+
+    "Created: / 02-03-2007 / 15:08:49 / cg"
+!
+
+confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default title:boxLabelOrNil
+    "launch a Dialog, which allows user to click on any button.
+     Return the corresponding value from the values array.
+     The labels for for the buttons are to be passed in
+     buttonLabels; 
+     The default argument (if non-nil) defines the index of the 
+     return button (1 to n)"
+
+    ^ self
+        confirmWithCancel:aString 
+        labels:buttonLabels 
+        values:buttonValues 
+        default:default 
+        check:nil on:nil
+        title:boxLabelOrNil
+
+    "
+     Transcript showCR:(
+         Dialog 
+            confirmWithCancel:'really ?'
+            labels:#('mhmh' 'maybe' 'definitely')
+            values:#(1 2 3)
+            default:3
+            title:'hello there'
      )
     "
 
@@ -1828,7 +1875,10 @@
     "launch a Dialog, which allows user to enter yes, no and cancel.
      return true for 'yes', false for 'no', nil for 'cancel'"
 
-    ^ self confirmWithCancel:aString default:nil title:titleString
+    ^ self 
+        confirmWithCancel:aString 
+        default:nil 
+        title:titleString
 
     "
      Dialog confirmWithCancel:'really ?' 
@@ -8781,7 +8831,7 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.284 2009-07-08 11:49:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.285 2009-09-04 09:22:05 cg Exp $'
 ! !
 
 DialogBox initialize!