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

Home » Public Forums » archive » Interupting a running procedure using Widget event interupts.
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
Interupting a running procedure using Widget event interupts. [message #83144] Tue, 05 February 2013 21:54
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
I am making a simple widget to interactively view sequences of images. I want basic 'player' functionality like play/pause, step forward/back.

The core issue is I don't know how to interrupt a loop using widget event interrupts (if that is even possible).

At the moment the event handler for the play/pause button start calls a procedure for looping through images. It sends it the base widget ID which allows the looping procedure to access the state via

WIDGET_CONTROL, wid,GET_UVALUE=pstate

where pstate is a pointer to a struct state={is_playing:0, direction:1,time:0.} to indicate if the images should be looping and in what direction. Time indicates the timestamp of the current image.

The loop does something like this

WIDGET_CONTROL, wid,GET_UVALUE=pstate
while (*pstate).is_playing do begin
<load image data from file and display>
<increment (*pstate).time>
wait,1
endwhile

The event handler for the play/pause button is also set to, if pressed while in the playing state, set (*pstate).is_playing=0 which I hoped would cause the above loop to quit out. Instead it gets stuck in an infinite loop and crashes the IDL session. I have to put and max iter in there to stop this, which defies the point of the exercise.

The route cause is that the player routine blocks the execution, preventing the event handler from being called again to change the value of (*pstate).is_playing. I set the /NO_BLOCK keyword to the XMANAGER but that made no difference.

Does anyone know how I could achieve what I'm trying to do, or is this just not possible?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL VM install
Next Topic: Re: Light Shed on GridData Mystery

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

Current Time: Wed Oct 08 15:06:02 PDT 2025

Total time taken to generate the page: 0.00391 seconds