Ask Reuben


What is the purpose of CLOSE WINDOW SCREEN?

What is this blank window behind my main window? 

What is the screen window?

In the first iterations of Genero back in the early 2000’s, the Genero development team encountered a problem. When displaying in a GUI environment, it is expected that everything is in a window.  However in Informix-4gl it was legal syntax for MENU to be the first UI statement and so the problem was… “Where is this MENU going to be rendered if it occurs before an OPEN WINDOW ?, as there is no window present to render the MENU in.”

The solution was to automatically open a window first.  This is known as the default screen window.  There are then two main strategies to deal with the screen window.

You can as part of your initialisation routines, execute a CLOSE WINDOW SCREEN, this will close the default screen window.  You then take responsibility via use of the OPEN WINDOW command to open windows to render your user interface in.  It is on you to ensure that if you execute a MENU or DISPLAY FORM that you have a window open to render the menu or form in.  if you don’t then you will get a -6311 error.

The second strategy is to accept the presence of the screen window and use OPEN FORM and DISPLAY FORM to render a form inside that window as shown in the code sample here.  Then use OPEN WINDOW for any additional windows to appear on top of this window.

Where we get the questions is when developers do not close the screen window and then use open window for their first form.  This results in situations where the empty screen window is visible as a small blank window behind your current window …

… and if you look in the Debug AUI Tree, you will see two Window nodes, one of which is named “screen” …

The solution is to either add the CLOSE WINDOW SCREEN, or to render your first form into the screen window using DISPLAY FORM instead of OPEN WINDOW.

The important thing is to adopt a strategy and be consistent about it.  Make sure that your code reviews and code quality tests are checking for it.  If you do utilise CLOSE WINDOW SCREEN, make sure that you always have a window open to which any MENU statement will be rendered.