Variable No. of Windows with Phase of Moon [message #60925] |
Tue, 24 June 2008 15:58  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Hi Folks,
Anyone seen this. I'm running a program on a Windows machine.
I want to know if a particular pixmap window is still open.
The window index number is something like 75. To check
whether it is still open or not, I get the window "state"
like this:
DEVICE, WINDOW_STATE=theState
This is suppose to be "an array containing one element
for each possible window". If it has a 1 in the right
slot, the window is open and available.
windowIsOpen = theState[75]
All well and good, but when I run my program, theState
variable changes from a 139-element array to a 65-element
array within seconds of running the exact same code!
I've done this many times, and I can find no pattern in
the output. Oh wait!! It is apparently Morse code. Let's
see...
S-W-I-T-C-H T-O M-A-T-L-A ...
Oh, never mind. I could have guessed that. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Variable No. of Windows with Phase of Moon [message #61067 is a reply to message #60925] |
Wed, 25 June 2008 07:51  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Spon writes:
> I'd suggest zero-padding your theState array out to 256 or something
> on the (hopefully correct!) assumption that windows with indices
> greater than (N_Elements(theState) - 1) will be closed.
>
> It's a crude work-around. Maybe the old Wait,0 trick will be more
> useful?
I just modified my code so that if the index number I'm looking
for exceeds the size of the array, then I just assume the window
is not available. No harm so far, but I am using this to
restore the current graphics window after I create a window
to do something else. I don't expect to have problems in my
code, since I always know what window I'm drawing into, but
I'm thinking of the thousands of poor saps who have no idea. ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Variable No. of Windows with Phase of Moon [message #61069 is a reply to message #60925] |
Wed, 25 June 2008 07:03  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> When I exit the color tool, the window state
> drops to 65, whereas before it was a much larger number. If
> I keep the color tool open, all is fine, if I destroy it I'm
> toast.
The problem is actually that it takes a variable amount
of time for the windows to "disappear" from IDL's knowledge
of them. Thus, my program works "sometimes", but not others,
depending, I suppose, on what else is going on while IDL
gets around to housekeeping. Having been forced to do some
housekeeping myself, I'm familiar with the problem. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|