| Re: anonymous structure as member of named event structure [message #41284 is a reply to message #41102] |
Sun, 03 October 2004 00:05  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Benjamin Hornberger wrote:
> Hi all,
>
> I want to send some info around between widgets and use widget_control,
> send_event = ... to do that. Since I want to use the name to identify
> the type of event, the event structure should be named. Now, the actual
> information I want to send is an anonymous structure (if absolutely
> necessary, I could make that named as well, but I would prefer anonymous).
>
> It turns out that IDL doesn't like (or rather, doesn't allow) anonymous
> structures to be members of a named structure. At the moment I am using
> a pointer to the anonymous structure as a member of the named event
> structure. However, I don't like that solution too much since the event
> handler to which I send the event has to free the pointer. As long as I
> do all the programming, I will remember that, but if several people are
> working on the project, I'll have to say "Hey, don't forget to free that
> pointer I am sending to you!" all the time.
>
> Any suggestions?
>
> Thanks,
> Benjamin
Dear Ben,
this is a new idea to use send_event for me.
But its regular, the online help tells:
This keyword applies to all widgets. Set this keyword to a structure
containing a valid widget event to be sent to the specified widget. The
value of SEND_EVENT must be a structure and the first three fields must be
ID, TOP, and HANDLER (all of LONG type). Additional fields can be of any
type. To improve the efficiency of the data transfer, consider using the
NO_COPY keyword with SEND_EVENT.
I always use UNAME to identify the widget element and it's UVALUE for data
transport. If you use pointers this is quite easy to use.
Here is an example from our excercise:
http://www.fz-juelich.de/vislab/software/idl_samples/Widgets /Oberflaechen
wid5.pro
cheers
Reimar
--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
|
|
|
|