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

Dietmar Schielke Dietmar.Schielke at
Tue Jun 5 12:20:54 UTC 2007

Thank for your links. I'll try to dig further into it.

A first look into SwitchMorph raises a first question in me:

When you call addDependent: should'nt be there a corresponding 
removeDependent: in the code?

Maybe connection: should first call removeDependent: for the old 
connection before setting a new connection?
Further, then I delete a SwitchMorph maybe  it should also disconnect from 
its's connections?


connection: anObject 
"Set anObject to be the connection among two or more Switches. Make the 
receiver a dependent of the argument, anObject."
connection ifNotNil: [ connection removeDependent: self ].    " THIS IS 
connection _ anObject.
connection addDependent: self 


"Edgar J. De Cleene" <edgardec2001 at> 
Gesendet von: beginners-bounces at
05.06.2007 13:37
Bitte antworten an
"A friendly place to get answers to even the most basic questions about 
Squeak." <beginners at>

"A friendly place to get answers to even the most basic questions about 
Squeak." <beginners at>

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

El 6/5/07 7:56 AM, "Dietmar Schielke" <Dietmar.Schielke at>

> 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 
> My problem is, that the submorphs need to do some clean up (unregister 
> dependents from the domain objects)  when they disapear from the world . 
> tried to overwrite delete in my submorphs, but delete was not called on 
> 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 
> subdevices (objects of class Subdevice with attributes like name, 
> state..) 
> To view and edit Devices with their subdevices i made a DeviceMorph (for
> viewing/editing the "primitive" attributes of Device) and a 
> (for the SubDevices). Devicemorphs hold Subdevicemorphs as submorphs.
> Subdevicemorphs register themself as dependent on an Subdevice object so 
> get infomed when the  Subdevice changes it's state (just the squeak 
> change notification mechanics). This works fine. I can open several
> DeviceMorphs for the same Device and a change on the device or its 
> 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 
> its SubDeviceMorphs from the SubDivices they have observed, because they 
> no longer visible and do not need the change notifications of their 
> anymore and because the reference from my SubDevice to my (now 
> SubDeviceMorph prevents the SubDeviceMorph from being garbage collected.
> Btw. I copied this design from the morphic counter example on
> The difference between the counter 
> an my problem is, that my domain objects live more independent of the 
> I have seen that morphs can have a model, but i have no idea how to use 
> 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 
do it.

In the time, I have my very old tutorial
see pict of finished project at:

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.


Beginners mailing list
Beginners at

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Beginners mailing list