简体   繁体   中英

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

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 ?

Use the intoWorld: / outOfWorld: mechanism.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM