Re: wait for close down of a widget [message #6509 is a reply to message #6507] |
Wed, 10 July 1996 00:00  |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
On Tue, 9 Jul 1996, Joost Sytsma wrote:
> I have a question on how to wait for the close down of a specific widget.
> <snip>
> "COLOR": BEGIN
> XLOADCT ; start xloadct to laod new colors
> REPEAT J=1 UNTIL (XREGISTERED("xloadct") EQ =0)
> ; wait until xloadct is done
> WSET, xplane_wid & TV, xplane ; refresh display to get new colors
> END
> <snip>
> I can check that xloadct is indeed registered, but once the program is in the
> repeat loop, xloadct does not react on the CLOSE button, and the program
> remains in the repeat loop. How come and what is the solution to it?
I can show you how to get this to work, but I can only give a half-hearted
arm-waving explanation about what's going on.
It seems that when one does the type of thing you have done - launch a
non-modal widget (event handler et al) from within an event handler and
try to check on its status without exiting "your" event handler - one gets a
weird nested, recursive thing going inside IDL, and things start behaving
illogically. ("Your" event handler was originally called by XMANAGER,
and now it is indirectly calling XMANAGER itself by invoking the new
widget. XMANAGER uses WIDGET_EVENT(), which is where the mystery really
lies...)
Anyway.
The trick in your case is to call WIDGET_EVENT() yourself:
xloadct,group=event.top ;give your TLB as group leader
repeat
j=widget_event(/nowait) ;don't specify a widget ID here
until xregistered('xloadct') eq 0
This appears to "shake things up" (without hustling events), with a result
that xregistered() works as expected.
Peter Mason
|
|
|