Re: iimage tool [message #39952 is a reply to message #39808] |
Wed, 23 June 2004 18:28  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
David Fanning wrote:
> Francois writes:
>
>
>> Concerning the iimage command, here is the answer from RSI.
>>
>>
>> If you call an iTool from within a program, the iTool will not start
>> responding to events until focus is returned to the Main level (The IDL
>> command line). You can get around this by periodically checking for events
>> using the WIDGET_EVENT routine. The following example demonstrates how this
>> can be done:
>
>
> Oh, dear. No debugging allowed. Silent error handlers...
>
> Do you get the impression we aren't suppose to be fooling
> around with this software!? :-)
Have you noticed that FSC_SURFACE exhibits the behaviour? :-)
The no-event-handling-while-waiting-at-a-breakpoint issue applies to all
(non-blocking) widget programs. Some will display a graph in this
situation, some will show an empty window (probably waiting for an
expose event), but in all cases you can't interact with them because the
widget queue is stopped.
This has frustrated me for some time. When I stop a program at a
breakpoint I want to be able to make use of the full range of
visualisation tools, not just blocking widgets and non-widget commands.
I recall this being discussed on the group, but I don't recall any
simple workaround being offered. (I vaguely recall there might have been
one, but I didn't pay enough attention to the thread, and a Google
search right now hasn't found anything.)
Based on Daryl Attencio's code, I came up with the routine below
(currently called MGH_YIELD, but I'm sure there's a better name).
The idea is that you have stopped at a breakpoint and you want to use
IPLOT (or FSC_SURFACE or whatever) to look at the variables. Or, as in
Francois's case, your code has called one of these routines before the
breakpoint.) So you launch IPLOT (if it's not already active) then type
MGH_YIELD at the IDL prompt. The command-line goes grey but you can
manipulate your widgets to your heart's content. When you want to
recover the command line, you go back to IDLDE and press Ctrl-Break (on
Windows) to interrupt MGH_YIELD. This dumps you in MGH_YIELD, whence you
can use Ctrl-UpArrow, or "return" at the IDL prompt, to get back to the
breakpoint. (This is the fragile part of the whole procedure. It's easy
to get lost in the call stack--you can use "help, /TRACEBACK" to check
where you are.)
This seems to work robustly under IDLDE in Windows
It might well be that the widget loop in MGH_YIELD could be wrapped in a
simple widget application with an Interrupt button, so that control
returns to the point where the application was launched.
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
pro MGH_YIELD
while 1B do begin
wait, 0.1
void = widget_event(/NOWAIT)
endwhile
end
|
|
|