Project .pr file and objets connected with dependency

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Project .pr file and objets connected with dependency

Hilaire Fernandes-5
Hello,

I do have strange behavior when I try to create project file containing
instanciated objets of my own. I have a collection of objects
communicating between them with the dependency system (using messages as
#when:send:to: and #triggerEvent:)

When I save such project, then load it in another image (containing the
necessary classes) the objects appear to be correctly saved, however the
dependency between the objects is broken.

I don't know that much about .pr file, so I wonder if the problem can
come from the objects being intereconnected with such dependency.
Can it be that?

Hilaire Fernandes

Reply | Threaded
Open this post in threaded view
|

RE: Project .pr file and objets connected with dependency

Blaine Buxton
Depedency is not saved in projects because by default objects store their
events in the EventManager object. Now, Morphs store their events in their
own action map, so they keep their events when projects are stored.

You can inside of your own objects have your own action map. Simply store
the actionMap into an instance variable inside of the class. and return its
value in the #actionMap message. All it needs to return is an
IdentityDictionary. Browse implementers of #actionMap for examples.

You could also override the serialization methods to serial out the action
map in the EventManager object for your instance, but I would do the
suggestion above since it's simpler and less code.

Hope this helps.
------------------------------------------------
Blaine Buxton, Mad Scientist In Training
http://www.blainebuxton.com

>From: Hilaire Fernandes <[hidden email]>
>Reply-To: The general-purpose Squeak developers
>list<[hidden email]>
>To: Squeak Devel <[hidden email]>
>Subject: Project .pr file and objets connected with dependency
>Date: Sat, 18 Mar 2006 15:05:50 +0100
>
>Hello,
>
>I do have strange behavior when I try to create project file containing
>instanciated objets of my own. I have a collection of objects
>communicating between them with the dependency system (using messages as
>#when:send:to: and #triggerEvent:)
>
>When I save such project, then load it in another image (containing the
>necessary classes) the objects appear to be correctly saved, however the
>dependency between the objects is broken.
>
>I don't know that much about .pr file, so I wonder if the problem can
>come from the objects being intereconnected with such dependency.
>Can it be that?
>
>Hilaire Fernandes
>

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement