[Code Request] ProgressBar morph widget

Andrew C. Greenberg werdna at gate.net
Sun Feb 27 16:55:52 UTC 2000


At 12:12 PM +0100 2/27/2000, Piero Campanelli wrote:
>Hi.
>
>I am building a GUI for SUnit framework port. I'd like to add a progress
>bar widget(which tells how many tests have been done). Any of you is
>developing (or has developed) this widget ?
>Tnx

You might want to look at:

displayProgressAt: aPoint from: minVal to: maxVal during: workBlock
	"Display this string as a caption over a progress bar while 
workBlock is evaluated.

EXAMPLE (Select next 6 lines and Do It)
'Now here''s some Real Progress'
	displayProgressAt: Sensor cursorPoint
	from: 0 to: 10
	during: [:bar |
	1 to: 10 do: [:x | bar value: x.
			(Delay forMilliseconds: 500) wait]].

HOW IT WORKS (Try this in any other language :-)
Since your code (the last 2 lines in the above example) is in a block,
this method gets control to display its heading before, and clean up
the screen after, its execution.
The key, though, is that the block is supplied with an argument,
named 'bar' in the example, which will update the bar image every
it is sent the message value: x, where x is in the from:to: range.

I note also that there are already several SUnit ports for Squeak.





More information about the Squeak-dev mailing list