--- a/ProgressIndicator.st Mon Jul 26 15:52:18 1999 +0200
+++ b/ProgressIndicator.st Tue Jul 27 13:22:37 1999 +0200
@@ -384,6 +384,43 @@
!ProgressIndicator class methodsFor:'instance creation'!
+displayProgress:aLabel at:aPoint from:startValue to:endValue during:aBlock
+ "easy interface - show progress while evaluating aBlock.
+ The block is passed a valueHolder, which is to be set to values from
+ startValue to endValue during the blocks evaluation.
+ This is scaled to 0..100% completion."
+
+ |p|
+
+ p := self
+ inBoxWithLabel:aLabel
+ icon:nil
+ text:aLabel
+ abortable:false
+ view:nil
+ closeWhenDone:true.
+
+ p showProgressOf:[:progressValue :currentAction |
+ aBlock value:[:scaledValue | progressValue value:( scaledValue - startValue
+ / (endValue-startValue)
+ * 100)].
+ ]
+
+ "
+ ProgressIndicator
+ displayProgress:'doobidoobidoo...'
+ at:(Screen default center)
+ from:200
+ to:400
+ during:[:val |
+ 200 to:400 by:2 do:[:i |
+ val value:i.
+ Delay waitForSeconds:0.1.
+ ]
+ ].
+ "
+!
+
inBox
"create a topView containing an instance of myself,
for later use with #showProgressOf:"
@@ -912,5 +949,5 @@
!ProgressIndicator class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.26 1999-04-23 12:46:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.27 1999-07-27 11:22:37 cg Exp $'
! !