Re: Q: Clearing Widget Events [message #6764] |
Thu, 15 August 1996 00:00 |
steinhh
Messages: 260 Registered: June 1994
|
Senior Member |
|
|
In article <4utfr2$av4@news1.ucsd.edu>, David Foster <foster@bial1.ucsd.edu> writes:
|> I've tried using
|>
|> WIDGET_CONTROL, /RESET
|>
|> to destroy all active widgets, but this doesn't seem to clear the
|> error condition, even if "retall" and "xmanager" are issued afterwards.
|> The next widget that is created is realized, but then you find yourself
|> at the IDL> prompt! [Any suggestions here?]
|>
What usually works fairly well in this situation is simply
IDL> xmanager
Since you have a fresh, newly registered widget that is initialized
for event processing (but the first xmanager was a fall-through one),
you seldom have problems with your widget being in an inconsistent
state.
I found another thing that works is to make your new widget (after
the crash, retall, reset) MODAL, this makes the widget program's
own xmanager call work, even though it believes that there's
another call to xmanager (the one it tries to fall back on if
non-MODAL operation was requested).
The problem with this is if you're developing a suite of
widget applications that really shouldn't be modal.
I've observed that if you do the following:
1 Start a widget
2 Crash it
3 retall, widget_control,/reset, etc. etc.
4 Restart a widget, ending up at the IDL> prompt
5 Type XMANAGER to process events for the new widget
6 Press the "done" button (or whatever) on the new widget,
for a graceful death.
then
7 the next restart of the widget has no problems.
So if we can make a cleanup file that does steps 3-6
automatically, we have a cleanup file that takes care of
this type of problem.
The difficult thing is step 6, but one could probably
do this automatically through the use of a TIMER event.
Haven't done this yet, but it might be worth a try.
Stein Vidar
|
|
|
Re: Q: Clearing Widget Events [message #6771 is a reply to message #6764] |
Wed, 14 August 1996 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
szoonem@astro.sunysb.edu (Saeid Zoonematkermani) wrote:
>
> Hello,
>
> I am trying to write my first serious widget application and the debugging
> process is confusing me. I am using IDL 4.0.1 on Mac OS.
>
> When some kind of error happens, the widget hangs up and I clear it with
> by pressing the close button. Then I use "WIDGET_CONTROL,/DESTROY,
> EVENT.TOP" and a "RETALL" after that. I return to the main and fix the bug
> and rerun the widget. The widget comes up but accepts no events and is
> totally incative. I have also tried "WIDGET_CONTROL,/CLEAR_EVENTS" and it
> doesn't seem to help. The only solution I have found, is to restart IDL.
> Does any one have any suggestions? Am I missing some thing very basic?
Your use of WIDGET_CONTROL, /DESTROY, /EVENT.TOP doesn't work for
two possible reasons: (1) since the program crashed, XMANAGER is
no longer processing events from this top-level-base, so
WIDGET_CONTROL doesn't work (you would have to issue the
executive command .CONTINUE to do this); and (2) the program may
crash while in some routine other than the event handler, so
EVENT will be undefined.
To clean things up after a crash, I destroy the widgets manually,
and then issue the commands:
retall
xmanager
Actually, I put these commands in a file called "clr", and type:
@clr
I've tried using
WIDGET_CONTROL, /RESET
to destroy all active widgets, but this doesn't seem to clear the
error condition, even if "retall" and "xmanager" are issued afterwards.
The next widget that is created is realized, but then you find yourself
at the IDL> prompt! [Any suggestions here?]
Hope this is useful.
Dave Foster
foster@bial1.ucsd.edu
|
|
|
Re: Q: Clearing Widget Events [message #6780 is a reply to message #6771] |
Tue, 13 August 1996 00:00  |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
On Tue, 13 Aug 1996, Saeid Zoonematkermani wrote:
> I am trying to write my first serious widget application and the debugging
> process is confusing me. I am using IDL 4.0.1 on Mac OS.
>
> When some kind of error happens, the widget hangs up and I clear it with
> by pressing the close button. Then I use "WIDGET_CONTROL,/DESTROY,
> EVENT.TOP" and a "RETALL" after that. I return to the main and fix the bug
> and rerun the widget. The widget comes up but accepts no events and is
> totally incative. I have also tried "WIDGET_CONTROL,/CLEAR_EVENTS" and it
> doesn't seem to help. The only solution I have found, is to restart IDL.
> Does any one have any suggestions? Am I missing some thing very basic?
After manually closing the widget (via the window manager) and typing RETALL,
one can sometimes get things back in order by typing XMANAGER (with no
arguments) at the command line.
If this doesn't work, try the more drastic WIDGET_CONTROL,/RESET.
But sometimes things simply get too stuck, and the only thing which works
is restarting IDL.
An alternative - especially if the bug is due to something simple like an
undefined variable - is to kludge a quick fix at the command line (e.g.,
define the missing variable) and type .CONT
Peter Mason
|
|
|
Re: Q: Clearing Widget Events [message #6781 is a reply to message #6780] |
Tue, 13 August 1996 00:00  |
Robert Moss
Messages: 74 Registered: February 1996
|
Member |
|
|
Saeid Zoonematkermani wrote:
>
> When some kind of error happens, the widget hangs up and I clear it with
> by pressing the close button. Then I use "WIDGET_CONTROL,/DESTROY,
> EVENT.TOP" and a "RETALL" after that. I return to the main and fix the bug
> and rerun the widget. The widget comes up but accepts no events and is
> totally incative. I have also tried "WIDGET_CONTROL,/CLEAR_EVENTS" and it
> doesn't seem to help. The only solution I have found, is to restart IDL.
> Does any one have any suggestions? Am I missing some thing very basic?
>
If you get an error, try simply using "RETALL" followed by "XMANAGER"
at the idl> prompt. If you are not saving any widget state information
in uvalues using /no_copy, this will often work just fine. If you
are using uvalues with the /no_copy option, the "retall" will cause you
to be unable to re-enter the xmanager successfully. In this case,
I do this: "retall", close the top level widget base using the window
manager (it wont always disappear immediately), then type "xmanager".
This will cause the widget hierarchy to be destroyed, and you can
restart it without restarting idl.
--
Robert M. Moss, Ph.D. - mossrm@texaco.com - FAX (713)954-6911
------------------------------------------------------------ -----
This does not necessarily reflect the opinions of Texaco Inc.
|
|
|
|