Re: Variable No. of Windows with Phase of Moon [message #61068 is a reply to message #60921] |
Wed, 25 June 2008 07:43   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Jun 25, 2:54 pm, Vince Hradil <hrad...@yahoo.com> wrote:
> On Jun 24, 5:58 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> 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.")
>
> Here's what happens for me. theState is initially 65 elements. If I
> open about 30 more windows using for i=0L, 29 do window, /free,
> theState expands. If I close those new windows, theState shrinks back
> to 65 elements. Is that what you see?
This is what I see when I do things logically and keep track of the
keyword's output. However, if I use commands like "Window, /Free" from
within procedures, and particularly if I use programs like
XInterAnimate that use pixmaps, then I can have no visible windows
open and theState can still have about 144 elements. If I then type
"Window, /Free", I get not one but two extra elements, only one of
which will be set to 1. Usually both of these extra elements will
disappear when I kill or WDelete the window. Usually. I've yet to
figure out when this does and doesn't happen.
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?
Regards,
Chris
|
|
|