El 6/5/07 7:56 AM, "Dietmar Schielke" Dietmar.Schielke@data-experts.de escribió:
Hi Edgar,
thanks for your answer :-) I will have to describe it better.
Yes my morph and its submorphs disappear correctly when I close/delete it.
My problem is, that the submorphs need to do some clean up (unregister as dependents from the domain objects) when they disapear from the world . I tried to overwrite delete in my submorphs, but delete was not called on my submorphs when i closed/deleted my GUI.
Here is a short sketch of my classes:
I have a class Device (with attributes name, ip-Adress, port) which holds subdevices (objects of class Subdevice with attributes like name, description, state..)
To view and edit Devices with their subdevices i made a DeviceMorph (for viewing/editing the "primitive" attributes of Device) and a SubdeviceMorph (for the SubDevices). Devicemorphs hold Subdevicemorphs as submorphs. Subdevicemorphs register themself as dependent on an Subdevice object so they get infomed when the Subdevice changes it's state (just the squeak standard change notification mechanics). This works fine. I can open several DeviceMorphs for the same Device and a change on the device or its subdevices via one of the openDevice Morphs ist instantly displayed on all open DeviceMorphs for that device.
When i close one of the DeviceMorphs observing my Device i need to unregister its SubDeviceMorphs from the SubDivices they have observed, because they are no longer visible and do not need the change notifications of their SubDevice anymore and because the reference from my SubDevice to my (now unvisible) SubDeviceMorph prevents the SubDeviceMorph from being garbage collected.
Btw. I copied this design from the morphic counter example on http://wiki.squeak.org/squeak/795. The difference between the counter example an my problem is, that my domain objects live more independent of the GUI.
I have seen that morphs can have a model, but i have no idea how to use it.
Thanks again,
Dietmar
I understand better now. It's really a good start point for doing a tutorial. I don't have time as 3.10 monopolize all I get, try to find some student for do it.
In the time, I have my very old tutorial http://ar.geocities.com/edgardec2001/LogicCircus1.html see pict of finished project at: http://wiki.squeak.org/squeak/5991
Is my bad use of Fabrik Dan idea for connecting and passing actions between morphic objects.
If think this could be useful , I have ready to load in any Squeak , could send or put somewhere.
Edgar