comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to keep two objects synchronized?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to keep two objects synchronized? [message #86099 is a reply to message #86098] Thu, 03 October 2013 06:20 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matthew Argall writes:

> Say I have a colorbar object and an image object and I want to keep their color table and color range the same whenever either of the objects are changed. Also, the colorbar is also positioned relative to the image, so if the image's position changes, the colorbar's should be updated as well.
>
> My idea is to store the colorbar as a property in the image. Internally, the image would then add itself the colorbar. When either are updated, trigger updates to the other (would need a flag to prevent infinite loops).
>
> With this, the ability to add images to colorbars would have to be a hidden feature in order to maintain the one-way work flow of adding colorbars to images.

In the Catalyst Library, one object registers its "interest" in another
object. Basically, it tells the object what kind of "message" it would
like to receive and adds its reference to the object's "send a message
to" container. So, for example, an image would register its interest in
a colorbar's Change Colors message. When the colors of the colorbar are
changed, the colorbar object looks in its message container to see if
anyone is interested. If so, the object calls the interested object's
MessageFrom method with the relevant information.

It works great. One advantage of this kind of communication is that
several images can register interest with, say, a colorbar object, and
they will all get updated when the colors change. This kind of messaging
infrastructure is built into the CatAtom object, which all objects
inherit in the Catalyst Library system. This way all objects can
communicate with other objects, even if you can't currently think of
anything for them to say. ;-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: about structures
Next Topic: Taylor Diagrams in IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:29:21 PDT 2025

Total time taken to generate the page: 1.27793 seconds