Re: IDL windows freeze (on windows) [message #54306] |
Wed, 06 June 2007 21:30  |
markb77
Messages: 217 Registered: July 2006
|
Senior Member |
|
|
On Jun 6, 11:31 pm, David Fanning <n...@dfanning.com> wrote:
>
> Can you explain in a little more detail how you use this.
> I'm curious about the problem.
>
Here's an example that illustrates the problem:
pro freeze_example
use_progress_bar = 0
use_mgh_waiter = 0
window, 1, xsize=400, ysize=400
wset, 1
device, set_graphics=6
stra = 'PROGRESS : ' + string(float(0)*100, format='(F6.2)')+' %'
xyouts, 0.5, 0.5, stra, alignment=1.0, CHARSIZE=1.25, /NORMAL
if use_progress_bar then begin
oprogbar = OBJ_NEW('progressbar', TITLE='WORKING', /NOCANCEL)
oprogbar -> Start
endif
if use_mgh_waiter then begin
owaiter = OBJ_NEW('MGHwaiter', TITLE='WORKING')
endif
for i = long(0), 10000 do begin
; do something time consuming here, for example
for j = long(0), 10000 do begin
a = fltarr(10000)
endfor
; update the user on progress
if i mod 100 eq 0 then begin
if use_progress_bar then oprogbar -> Update, (float(i)/
(100000))*100
if use_mgh_waiter then owaiter -> Yield
xyouts, 0.5, 0.5, stra, alignment=1.0, CHARSIZE=1.25, /
NORMAL
stra = 'PROGRESS : ' + string((float(i)/(100000))*100,
format='(F6.2)')+' %'
xyouts, 0.5, 0.5, stra, alignment=1.0, CHARSIZE=1.25, /
NORMAL
endif
endfor
if use_progress_bar then OBJ_DESTROY, oprogbar
if use_mgh_waiter then OBJ_DESTROY, owaiter
device, set_graphics=3
end
If both use_progress_bar and use_mgh_waiter are set to zero, then the
user can see updates on the task progress in the window as long as
they don't interfere with the window in any way, ie. as long as they
don't minimize it, drag something in front of it, etc etc. Any of
these actions will result in the window going blank and simply showing
a white space until the task has completed. Not only that but the
entire IDLDE is locked up. This can be very annoying if you are
running lots of long tasks! This is true for Object graphics windows
and direct graphics windows. This is a Windows-specific problem
apparantly - I've read that this doesn't happen on Unix machines. I'm
running IDL 6.2 and Windows XP Pro.
If one of use_progress_bar or use_mgh_waiter are set to 1, the problem
is avoided. These objects force windows to update the IDL graphics
windows and manage the IDLDE.
Sorry David regarding my earlier comment about Progressbar not solving
the problem - I must have made some mistake. When I wrote this
example it worked fine.
Mark Bates
Harvard University
Dept. of Chemistry and Chemical Biology
|
|
|