use new windowGroupQuery for background process
authorClaus Gittinger <cg@exept.de>
Thu, 18 Jul 1996 13:37:32 +0200
changeset 219 44246b9b4288
parent 218 9b155a06f6e6
child 220 ececd8efb00c
use new windowGroupQuery for background process
ProgressIndicator.st
--- a/ProgressIndicator.st	Thu Jul 18 12:06:55 1996 +0200
+++ b/ProgressIndicator.st	Thu Jul 18 13:37:32 1996 +0200
@@ -17,7 +17,7 @@
 	category:'Views-Misc'
 !
 
-!ProgressIndicator class methodsFor:'documentation'!
+!ProgressIndicator  class methodsFor:'documentation'!
 
 copyright
 "
@@ -310,7 +310,7 @@
 "
 ! !
 
-!ProgressIndicator class methodsFor:'instance creation'!
+!ProgressIndicator  class methodsFor:'instance creation'!
 
 inBox
     ^ self inBoxWithLabel:'executing ...' abortable:false 
@@ -327,14 +327,26 @@
     "create a topView containing an instance of myself,
      for later use with #showProgressOf:"
 
+    ^ self
+        inBoxWithLabel:aLabel   
+        text:''
+        abortable:abortable
+
+    "Modified: 17.7.1996 / 15:14:58 / cg"
+!
+
+inBoxWithLabel:aLabel text:text abortable:abortable
+    "create a topView containing an instance of myself,
+     for later use with #showProgressOf:"
+
     |top p l h|
 
     top := Dialog new.
-    top extent:300@100; sizeFixed:true.
+"/    top extent:300@100; sizeFixed:true.
     top label:aLabel.
     top cursor:(Cursor wait).
 
-    l := top addTextLabel:''.
+    l := top addTextLabel:text.
     l borderWidth:0.
     l adjust:#left.
     l cursor:(Cursor wait).
@@ -352,11 +364,14 @@
     top addComponent:p.
 
     abortable ifTrue:[
-	top addVerticalSpace.
-	top addAbortButton
+        top addVerticalSpace.
+        top addAbortButton
     ].
 
     ^ p
+
+    "Created: 17.7.1996 / 15:14:33 / cg"
+    "Modified: 17.7.1996 / 15:16:58 / cg"
 ! !
 
 !ProgressIndicator methodsFor:'accessing'!
@@ -467,40 +482,46 @@
 
      Caveat: cannot (currently) suppress close of the box ..."
 
-    |progressValue labelValue p|
+    |progressValue labelValue p wg|
+
+    wg := WindowGroup activeGroup.
 
     progressValue := 0 asValue.
     labelValue := '' asValue.
 
     connectedLabel notNil ifTrue:[
-	connectedLabel 
-	    model:labelValue;
-	    aspect:#value;
-	    labelMessage:#value.
+        connectedLabel 
+            model:labelValue;
+            aspect:#value;
+            labelMessage:#value.
     ].
 
     self model:progressValue.
 
     p := [
-	[
-	    aBlock value:progressValue value:labelValue
-	] valueNowOrOnUnwindDo:[
-	    p := nil.
-	    connectedTop notNil ifTrue:[
-		connectedTop hide
-	    ]
-	]
+        [
+            WindowGroup windowGroupQuerySignal handle:[:ex |
+                ex proceedWith:wg
+            ] do:[
+                aBlock value:progressValue value:labelValue
+            ]
+        ] valueNowOrOnUnwindDo:[
+            p := nil.
+            connectedTop notNil ifTrue:[
+                connectedTop hide
+            ]
+        ]
     ] fork.
 
     connectedTop notNil ifTrue:[
-	Processor activeProcess 
-	    withPriority:(Processor activePriority + 1)
-	    do:[
-		self topView show.
-	    ].
-	p notNil ifTrue:[p terminate].
+        Processor activeProcess 
+            withPriority:(Processor activePriority + 1)
+            do:[
+                self topView show.
+            ].
+        p notNil ifTrue:[p terminate].
     ] ifFalse:[
-	self halt:'not yet implemented'.
+        self halt:'not yet implemented'.
     ]
 
 
@@ -509,27 +530,29 @@
 
       p := ProgressIndicator inBox.
       p showProgressOf:
-	    [:progressValue :currentAction |
-		1 to:100 do:[:percent |
-		    (Delay forSeconds:0.05) wait.
-		    progressValue value:percent 
-		].
-	    ].
+            [:progressValue :currentAction |
+                1 to:100 do:[:percent |
+                    (Delay forSeconds:0.05) wait.
+                    progressValue value:percent 
+                ].
+            ].
 
       'it can be reused ...'.  
       p showProgressOf:
-	    [:progressValue :currentAction |
-		1 to:100 by:5 do:[:percent |
-		    (Delay forSeconds:0.05) wait.
-		    progressValue value:percent 
-		].
-	    ].
+            [:progressValue :currentAction |
+                1 to:100 by:5 do:[:percent |
+                    (Delay forSeconds:0.05) wait.
+                    progressValue value:percent 
+                ].
+            ].
 
     "
+
+    "Modified: 17.7.1996 / 20:36:51 / cg"
 ! !
 
-!ProgressIndicator class methodsFor:'documentation'!
+!ProgressIndicator  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.7 1996-06-05 18:15:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.8 1996-07-18 11:37:32 cg Exp $'
 ! !