Morph update

Andreas Raab andreas.raab at gmx.de
Wed Dec 4 20:20:06 UTC 2002


> There is also layoutChanged, which will force the layout to 
> be updated (and the Morph redrawn).

#layoutChanged will *NOT* force the morph to be updated. All
#layoutChanged does it to invalidate its layout so it can be recomputed
later on and if that recomputation leads to change in position/size
*then* the morph will be invalidated. 

Here's a simple example to play with:

ChangingMorph>>drawOn: aCanvas
	"change the color each time I am redrawn so we can see it"
	color = Color white 
		ifTrue:[color := Color black]
		ifFalse:[color := Color white].
	super drawOn: aCanvas.

ChangingMorph>>stepTime
	"as often as possible"
	^1

ChangingMorph>>step
	"invalidate me"
	self changed.

Note that using #layoutChanged in the step method will *not* cause the
morph to be updated.

Cheers,
  - Andreas


> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Ned Konz
> Sent: Wednesday, December 04, 2002 5:57 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: Morph update
> 
> 
> On Wednesday 04 December 2002 08:51 am, Bergel Alexandre wrote:
> 
> > I have a subclass of Morph, on which I redefine the method drawOn:
> > Body of drawOn: is influenced by external event, such as the key,
> > how can I make the morph refreshed ? Morph>>repaint, Morph>>update,
> > ... seems to be hided using fancy name...
> 
> Morph>>changed will invalidate the area of the Morph, causing 
> it to be 
> redrawn soon.
> 
> There is also layoutChanged, which will force the layout to 
> be updated 
> (and the Morph redrawn).
> 
> -- 
> Ned Konz
> http://bike-nomad.com
> GPG key ID: BEEA7EFE
> 
> 




More information about the Squeak-dev mailing list