By default, winio@ does not return until the window that it creates is closed. Occasionally it is useful to create a window that remains open while the program takes other actions. %lw (Leave Window Open) causes winio@ to return as soon as it has created the window (the return value of winio@ is not used in this case). The format takes one INTEGER argument that can be used to close the window. This integer, known as the control variable, is set to -1 while the window is still active. It is very important that the control variable used to receive the result does not cease to exist before the window closes. Hence it is necessary to use a variable that is either global (appears in the main program, a COMMON block or MODULE) or static (appears in a SAVE or DATA statement).
%lw is also used to create a child window that is to be inserted within another window that includes %ch (Child Window). The grave accent (`) is used in this context. In this case the window is not displayed until the control variable is passed to the window containing %ch. See %ch below for an example of this procedure. A child window may be used only once. If it is not used it will be destroyed when the program terminates.
A window that has been left open by means of %lw can be closed by setting its control variable to a non-negative value and by passing the address of the control variable to window_update@. Setting the control variable to -2 will close the window after a short delay.
i=winio@('Processing - please wait%lw',control)
It is possible to use %lw in conjunction with graphics drawing using %gr (Graphics Region), %og (OpenGL Graphics Region) or %dw (Owner Draw Graphics). This provides a means of drawing to a region after it has been created. However, it is recommended that code to draw to a graphics region be placed in a call-back function attached to %sc (OnShow Callback).