Antwort: Re: Antwort: Re: [Newbies] closing/deleting a morph and
dependents
Dietmar Schielke
Dietmar.Schielke at data-experts.de
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?
Like
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
NEW"
connection _ anObject.
connection addDependent: self
Dietmar
"Edgar J. De Cleene" <edgardec2001 at yahoo.com.ar>
Gesendet von: beginners-bounces at lists.squeakfoundation.org
05.06.2007 13:37
Bitte antworten an
"A friendly place to get answers to even the most basic questions about
Squeak." <beginners at lists.squeakfoundation.org>
An
"A friendly place to get answers to even the most basic questions about
Squeak." <beginners at lists.squeakfoundation.org>
Kopie
Thema
Re: Antwort: Re: [Newbies] closing/deleting a morph and dependents
El 6/5/07 7:56 AM, "Dietmar Schielke" <Dietmar.Schielke at 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
_______________________________________________
Beginners mailing list
Beginners at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070605/6c6d182d/attachment.htm
More information about the Beginners
mailing list