Which graphic windows are available?

It may seems that IDL offers an unlimited number of graphic windows and that therefore you will never have that problem of knowing which graphic windows are available to display a new plot or image. Well this is not totally true. Obviously it is hard to exhaust that number with the window command. But they are hidden windows in most of the widgets you will use and these can pile up quite fast.

Furthermore, if you are writing a program which, at one points needs to display a graphical information, you may want to do so in a yet unused window (to avoid overwriting on a potentially important piece of information). It is in that very case that you would want an automated way to know which graphical windows are not used and therefore available.

You can do that by with the command:


This places in the variable ws a 65 elements vector. 65 because there are 65 graphic windows available. Of these 65, not all should be used by your programs: window numbers above 32 are attributed to the graphical elements of the widgets (each times a widget shows an image or a graph, it is because it contains a display element which has its own ID number). These window numbers are atttributed dynamically so it is quite unsafe to try and use them (i.e. you might create some mix up and loose you display). Numbers between 0 and 31 correspond to graphic windows that you may use.

ws is actually a byte vector. A value of 1 a one position means that this window is currently used, a value of 0 means that it is free.