How to detect the removal of a submorph when the owner is deleted

269 views Asked by At

If I have a morph that contains submorphs, and I delete it, what messages get sent to the submorphs? delete is not being sent.

Here is the situation. I have a container Morph (not subclassed) which holds some submorphs of class MyMorph. After I open the container Morph in world, I close it (from the Morphic halo, or by sending it delete from an inspector. I want the MyMorphs to do something at that time. But I don’t want to make a subclass just for the container Morph. (If I did that, I could just handle delete and have it send some message to each MyMorph). So, is there some message that does get sent by the Morph to each of its submorphs when handling delete?

1

There are 1 answers

1
codefrau On BEST ANSWER

Use the intoWorld: / outOfWorld: mechanism.

For an example see MorphTest>>testIntoWorldDeleteOutOfWorld (which uses TestInWorldMorph).