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

Home » Public Forums » archive » Re: How to retrieve the event structure returned to event function of widget ?
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: How to retrieve the event structure returned to event function of widget ? [message #29747] Mon, 18 March 2002 20:42
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Xtynkt (Xtynkt@cheerful.com) writes:

> I am trying to figure out how to retrieve the event structure returned
> in a widget event function. For example, I am figuring out how cw_zoom
> works, and am reading through the programmes. The widget event for
> cw_zoom is written in function form, and one of the widgets is a
> button and once it is pressed, a structure is returned to the event
> function (the description is: when this button is pressed, this widget
> will generate an event structure containing several data fields. This
> event is a report to the parent that allows retrieval of the zoomed
> image using WIDGET_CONTROL).
>
> This is how I have done so far: (Z is image file)
> slide_image, top_id=base, Z
> zoom = cw_zoom(base, xsize=nx, ysize=ny, x_scroll_size=200,
> y_scroll_size=200)
> widget_control, zoom, set_value=Z
>
> Then the image is there, and I can zoom properly, and after I choose
> an area to zoom, I press "REPORT ZOOM TO PARENT" button. But after
> that I wonder how do I retrieve this structure.
>
> I have been figuring this out for a long time, reading the cw_zoom
> source code and so on... and trying widget_control get_value... but
> that will only retrieve values returned by functions or programmes
> predefined by func_get_value when this cw_zoom compound widget is
> created.
>
> Does anyone has any idea how can I do that ?

Oh, dear. I can't really imagine two worse examples to
learn widget programming from. :-(

The basic problem here is that Slide_Image doesn't
really need widget functionality to work, so it doesn't
normally generate events. The documentation doesn't tell
you this, but to *make* it generate events, you have to
set either the REGISTER or BLOCK keywords when you call
it. Setting either one of these keywords will call
XManager to process events.

(CW_ZOOM has it's own event loop, separate from the
one set up by XMANAGER, but that is another sad story
and it doesn't really do any good to go into it here. It
will certainly confuse you and it's enough to know that
hardly anyone I know has *ever* written a widget program
that works like this.)

Once you set, say, the REGISTER keyword, the "event" you
are looking for from CW_ZOOM will show up in the SLIDE_IMG_EVENT
event handler. (Where it will promptly destroy the entire
widget. Hope that is what you had in mind!)

Good luck with this. It you wanted a widget program to zoom
into an image that was a little easier to understand, you
might want to have a look at ZIMAGE on my web page:

http://www.dfanning.com/programs/zimage.pro

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to retrieve the event structure returned to event function of widget ?
Next Topic: Image subtraction

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

Current Time: Fri Oct 10 14:34:55 PDT 2025

Total time taken to generate the page: 0.56320 seconds