Re: Catching events within Widgets [message #5946 is a reply to message #5941] |
Fri, 08 March 1996 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <4hpdpg$205@oban.cc.ic.ac.uk>, justin@ic.ac.uk (Justin) writes:
>
> My problem is this: I have written a widget program with start and stop
> buttons, the trouble is once the start button is pressed the called procedure
> grabs control of IDL and so the stop button has no effect.
> At present there is a flag defined in common blocks within the event handler
> and the called procedure, and the procedure runs on a 'while flag eq 1' type
> loop. When the stop button is pressed the flag should be set to zero so the
> procedure 'hears about' it through the common block. The events do get
> queued, yet they are never actioned on.
> Is there anyway to check to see if any events are queued and if so action on
> them, and do this within a procedure?
> Without going into details, using the timer event just isn't suitable for my
> procedure.
The fundamental problem is that IDL only allows a single thread of execution.
When you called your procedure it will run until completion because the only
way for the flag in your common block to get updated is for XMANAGER to call
your event handler and set the flag. But XMANAGER never gets to run (it is
just another IDL procedure) until your called procedure returns.
The behavior you describe is extremely desirable for many applications. It
will require IDL to support multi-threaded execution. Someday?
____________________________________________________________
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)
|
|
|