[ENH] NewProgressBar

Ken G. Brown kbrown at tnc.ab.ca
Thu Apr 8 16:44:15 UTC 2004


If you replace the following snippet 
Display boundingBox center
with 
ActiveWorld activeHand cursorPoint
it displays centered at the cursor position. I kinda got used to that and
like it.

   Ken


   > -----Original Message-----
   > From: squeak-dev-bounces at lists.squeakfoundation.org 
   > [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
   > Behalf Of Stéphane Rollandin
   > Sent: Thursday, April 08, 2004 6:41 AM
   > To: The general-purpose Squeak developers list
   > Subject: Re: [ENH] NewProgressBar
   > 
   > 
   > 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