[ENH] NewProgressBar

Stéphane Rollandin lecteur at zogotounga.net
Thu Apr 8 12:40:59 UTC 2004


I found a very simple way to have a clean display when grabbing the 
progress morph:

[ProgressMorph example] fork

	now works fine !


here is the change (method ProgressMorph>>label:min:max:)

----------------------

label: shortDescription min: minValue max: maxValue
	| slot range newBarSize barSize |
	slot _ self nextSlotFor: shortDescription.
	slot = 0 ifTrue: [^[:barVal| 0 ]].
	self openInWorld.
	self align: self fullBounds center with: Display boundingBox center.
	barSize _ 0.
	range _ maxValue - minValue.
	^[:barVal |
		(barVal between: minValue and: maxValue) ifTrue: [
		newBarSize _ (barVal - minValue / range * BarWidth) truncated.
		newBarSize = barSize ifFalse: [
			barSize _ newBarSize.
			(bars at: slot) barSize: barSize; changed]].
		slot]


----------------------

is there any side effect ? (I don't understand what the lastRefresh 
thing was there for :))


Stef





More information about the Squeak-dev mailing list