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

Home » Public Forums » archive » Re: Interrupting widget applications
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Interrupting widget applications [message #7944 is a reply to message #7940] Thu, 23 January 1997 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
hegde@news.gsfc.nasa.gov (M Hegde) writes:

> Hi,

> What is the best way to interrupt a loop in widget applications?.
> According to my IDL knowledge, IDL doesn't support concurrency; so I can't
> have a button/widget to do that. Ctrl-C is not a smart way as it exits the
> application. Any suggestions?.

What you need to do is to break your application down into discrete events, and
then use TIMER events to run the events in sequence. For example, if your
program uses a FOR loop, then you could instead make each run through the loop
a discrete event, and store the loop counter between events.

For example, you might define your main base with a line like

MAIN_BASE = WIDGET_BASE(TITLE='CDS FITS Generation Software', $
/FRAME, /COLUMN, UVALUE='Timer')

and then in the event handler you would have code that would read

WIDGET_CONTROL, EV.ID, GET_UVALUE=VALUE
IF VALUE EQ 'Timer' THEN BEGIN
... do one piece of the complete operation ...

It's important to restart the timer after every timed event, to keep it going.
What I like to do is to keep a parameter called RUNNING which can be either 0
or 1. A start button generates an event which does some initial preparation
(e.g. setting the loop counter to 0), and sets RUNNING=1. Then at the bottom
of the event handler routine I put a line like

IF RUNNING THEN WIDGET_CONTROL, MAIN_BASE, TIMER=0.1

A stop button simply sets RUNNING=0.

Bill
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: display many color images
Next Topic: Re: color buttons

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

Current Time: Sat Oct 11 19:06:01 PDT 2025

Total time taken to generate the page: 3.12298 seconds