Re: XMANAGER, and loops [message #6532] |
Mon, 08 July 1996 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
"George, Rachel, and Molly" <gmccabe@potomac.net> wrote:
> I am trying to create a widget program with several functions
> called by button events. The XMANAGER is used with a widget event
> handler inside which a CASE statement block contains the possible events
> and corresponding program responses.
> If one of the widget buttons is for beginning a continuous loop
> like for example what I want to do is shuffle through a stack of images
> from beginning to end and repeat until another button is pushed, the STOP
> button. How do I retreive the event using the XMANAGER when the event
> handler procedure is stuck in a loop? That at least is how I have
> attempted to construct the procedure, in this form it does not work. If
> I knew how to give control back from the XMANAGER and enter a mode where
> I use WIDGET_EVENT statements within the loop then I could but, I can't
> figure out how.
Check out the !NEWS IDL Newsletter Volume 6, Number 1 (Summer 96)
if you have it. It has an example illustratiing how to do what you
are asking.
Basically, within the loop in the event handler, you use
WIDGET_EVENT() to poll for events generated from the widget
heirarchy "represented" by the widget id argument to WIDGET_EVENT().
Something like:
quit_loop = 0
while ( quit_loop eq 0 ) do begin
...
quit = WIDGET_EVENT( event.top, /nowait )
if ( quit.id eq state.cancel_button ) then $
quit_loop = 1
...
endwhile
Hope this helps.
Dave Foster
foster@bial1.ucsd.edu
|
|
|