Re: anonymous structure as member of named event structure [message #41281 is a reply to message #41102] |
Sun, 03 October 2004 06:54   |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Reimar Bauer wrote:
> 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
>
Well, actually my explanation was not completely correct. I don't want
to send information from a widget to a widget (which I could do the way
Reimar suggests), but I want to send information from a TCP/IP client to
a widget program.
We have a scanning microscope run by C++ software, and an IDL widget
program as user interface. They talk to each other via sockets (IDL
client, C++ server). The method described above I want to use if the
microscope has to send something (say, a motor position) to have a text
field value updated in the GUI.
The server then sends the info to the client, who has the GUI's TLB's
widget ID stored in its common block. The client procedure which watches
the socket for messages from the server can then create an event
structure which it sends to the GUI via widget_control, send_event ...
So, since the client is not a widget program, I can't use user values
and user names. Any further comments or suggestions?
Thanks,
Benjamin
|
|
|