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

Home » Public Forums » archive » Re: sharing information across widget hierarchies
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: sharing information across widget hierarchies [message #72100] Mon, 09 August 2010 18:28
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Aug 6, 11:23 pm, Chris <beaum...@ifa.hawaii.edu> wrote:
> Ok, I can get around this by attaching the _same_ event function to
> widgets 2 and 3. Now at least a single function gets called whenever
> an event happens; but there's no single widget in which to store state
> information. So then I have to store the state information as a
> _pointer_ in the uvalue to widgets 2 and 3. This means that I'm
> constantly dereferencing the state information pointer, which is much
> more awkward (syntactically) than working with a single, non-pointer
> variable (does anyone else hate how ugly x =
> (*(*state_ptr).big_array_ptr)[first_col, *] looks?)

With IDL 8, you can both have simpler code and only pass around a
reference, using a hash instead of a structure. This removes two
levels of indirection: the one used to pass a pointer instead of
copying the structure, and the other to have dynamic fields in it. For
instance, the fragment above could be just

(state_hash['big_array'])[first_col,*]
Re: sharing information across widget hierarchies [message #72101 is a reply to message #72100] Mon, 09 August 2010 18:15 Go to previous message
Robbie is currently offline  Robbie
Messages: 165
Registered: February 2006
Senior Member
I'd say that if your widget is much more complicated than a few text
boxes then you should always use a pointer or object to store the
program state. Using a pointer means that you can get your data into
the place where you want it, without copying it. Whatever you might
loose with poor syntax, you gain with code re-use.

Robbie
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL 8.0 now available
Next Topic: Re: svdfit-measure_errors

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

Current Time: Wed Oct 08 19:14:51 PDT 2025

Total time taken to generate the page: 0.00570 seconds