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
|
|
|
Re: XMANAGER, and loops [message #6538 is a reply to message #6532] |
Sun, 07 July 1996 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <31DD76B6.4FD0@potomac.net>, "George, Rachel, and Molly" <gmccabe@potomac.net> writes:
> Hello,
>
> 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.
One way to do this is to do the following:
- User presses START button
- Event handler sets mode = "image loop" and sets a timer for .1 seconds
- If the next event is a timer event and mode="image loop" then display
next image and set timer again, etc.
- If next event is STOP button then set mode="normal"
____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
|
|
|