Antwort: Re: [Newbies] closing/deleting a morph and dependents

Dietmar Schielke Dietmar.Schielke at data-experts.de
Tue Jun 5 10:56:44 UTC 2007


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

Edgar schrieb:
>El 6/5/07 4:24 AM, "Dietmar Schielke" <Dietmar.Schielke at data-experts.de>
>escribió:
>
>> 
>> Hi Squeakers, 
>> 
>> i made a simple morph with submorphs. the submorphs are views for some 
domain
>> objects and are dependents of them ( domainobj addDependent: mysubmorph 
).
>> Every thing works fine :-)
>> but i can't figure out, how to remove my submorphs from the dependents 
list of
>> my domain object, when I close/delete my morphic gui.
>> It seems Morph delete does not call delete recursively on its 
submorphs. Is
>> there an other way submorphs get informed when they are removed from 
the
>> screen? 
>> 
>> Thanks in advance,
>> 
>> Dietmar 
>
>Could send sample ?
>Morph could be viewed as "containers" of all submorphs inside .
>As example any Tools is a SystemWindow and a model for it.
>Select a Browser as example and you could see have many submorphs.
>Deleting the window , delete all submorphs inside.
>
>Or I misunderstanding you ?
>
>Edgar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070605/b1ba67b4/attachment-0001.htm


More information about the Beginners mailing list