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

Home » Public Forums » archive » anonymous structure as member of named event structure
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
anonymous structure as member of named event structure [message #41102] Fri, 01 October 2004 12:50 Go to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
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
Re: anonymous structure as member of named event structure [message #41280 is a reply to message #41102] Sun, 03 October 2004 07:35 Go to previous message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
Benjamin Hornberger wrote:
>>
> 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

Ok, I realize that I could update the field values directly from the
client if it knew their specific widget IDs. But I don't want to give
the client direct control over the GUI, that's why I want to send an
event, and the GUI can then decide what to do with the event.

Benjamin
Re: anonymous structure as member of named event structure [message #41281 is a reply to message #41102] Sun, 03 October 2004 06:54 Go to previous message
Benjamin Hornberger is currently offline  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
Re: anonymous structure as member of named event structure [message #41284 is a reply to message #41102] Sun, 03 October 2004 00:05 Go to previous message
R.Bauer is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL removes dimensions of size 1 automatically
Next Topic: array operators - vector processing relevant

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

Current Time: Wed Oct 08 19:55:41 PDT 2025

Total time taken to generate the page: 0.00221 seconds