DialogBox.st
changeset 6406 de31d4ed0246
parent 6396 0263fa4eae4a
child 6410 2316993d032e
--- a/DialogBox.st	Sat Aug 25 14:41:59 2018 +0200
+++ b/DialogBox.st	Sun Aug 26 17:10:16 2018 +0200
@@ -1220,7 +1220,9 @@
 !
 
 informUser:aString during:aBlock
-    "show a message-box while executing aBlock"
+    "show a message-box while executing aBlock.
+     If aBlock expects an argument, pass it the box,
+     so it can change its label via label:"
 
     |box|
 
@@ -1229,12 +1231,25 @@
         box hideButtons.
         self showBox:box. "/ box showAtPointer.
     ] forkAt:(Processor activePriority + 1).
-    aBlock ensure:[box destroy]
+    
+    [aBlock valueWithOptionalArgument:box] ensure:[box destroy]
 
     "
      Dialog informUser:'wait a second...' during:[Delay waitForSeconds:1]
-     Dialog informUser:'wait a few seconds...' during:[10000 factorial]
-    "
+     Dialog informUser:'wait a few seconds...' during:[100000 factorial]
+
+     Dialog 
+        informUser:'wait two seconds...' 
+        during:[:box |
+            Delay waitForSeconds:1.
+            box label:'still running...'.
+            Delay waitForSeconds:1.
+            box label:'one more second...'.
+            Delay waitForSeconds:1.
+        ]
+    "
+
+    "Modified: / 26-08-2018 / 17:09:42 / Claus Gittinger"
 !
 
 informUser:aString during:aBlock cancel:canCancel
@@ -1250,7 +1265,7 @@
     ].
 
     subProcess := [
-        aBlock ensure:[box destroy]
+        [aBlock valueWithOptionalArgument:box] ensure:[box destroy]
     ] forkAt:(Processor activePriority - 1).
 
     self showBox:box.
@@ -1261,7 +1276,20 @@
      Dialog informUser:'don''t wait ...' during:[true] cancel:true
      Dialog informUser:'please wait a second...' during:[Delay waitForSeconds:1] cancel:true
      Dialog informUser:'please wait, while I compute 30000 factorial...' during:[30000 factorial] cancel:true
-    "
+
+     Dialog 
+        informUser:'wait two seconds...' 
+        during:[:box |
+            Delay waitForSeconds:1.
+            box label:'still running...'.
+            Delay waitForSeconds:1.
+            box label:'one more second...'.
+            Delay waitForSeconds:1.
+        ]
+        cancel:true
+    "
+
+    "Modified: / 26-08-2018 / 17:09:27 / Claus Gittinger"
 !
 
 information:aString
@@ -1293,6 +1321,7 @@
     "
 
     "Created: / 22-12-2010 / 19:33:23 / cg"
+    "Modified: / 26-08-2018 / 17:06:51 / Claus Gittinger"
 !
 
 informationText:aString title:windowTitle
@@ -1381,7 +1410,7 @@
             nativeWarnOK:aString
             title:windowTitle
     ].
-    self showAndThenDestroyBox:(WarningBox title:aString label:windowTitle)
+    self showAndThenDestroyBox:(WarningBox title:windowTitle label:aString)
 
     "
      Dialog warn:'some warning message'
@@ -1399,6 +1428,7 @@
 
     "Modified: / 29-05-1996 / 15:23:14 / cg"
     "Created: / 20-01-2012 / 15:54:26 / cg"
+    "Modified: / 26-08-2018 / 17:00:14 / Claus Gittinger"
 ! !
 
 !DialogBox class methodsFor:'confirmation dialogs'!