Why don't morphs remove transforms when deleted?

Bob Arning arning at charm.net
Wed May 24 21:08:46 UTC 2000


On Thu, 25 May 2000 21:33:47 +0100 "Jonathan Coupe" <jonathan at meanwhile.freeserve.co.uk> wrote:
>If I delete a Morph by issuing the delete message, then it leaves a
>TransformationMorph behind in the world. This doesn't happen if I dismiss
>the morph using its halo's pink-x button. Looking at the code, its obvious
>how this happens, but not why.
>
>Is it intended that a morph shouldn't delete its tranform when deleted? If
>so, why?
>
>If there's no reason why I shouldn't, then I'm going to have some of my
>classes start to delete their transforms when they're deleted. Off the top
>of my head I'll either do this by searching the World in the same way
>Morph>>halo does, or keeping track of the TransformationMorphs as they are
>created in addFlexShell.

Jonathon,

I can't tell you why it's that way, but here are some tips if you want to be sure to delete the transforms as well

instead of

	someMorph delete

you send

	someMorph topRendererOrSelf delete

then you will get the TransformationMorph (and/or DropShadowMorph as well). If you need this in a lot of places, you might implement

Morph>>deleteCompletely

	self topRendererOrSelf delete

or you can implement #delete methods in your classes that do something similar.

Cheers,
Bob





More information about the Squeak-dev mailing list