In this section:
ClearWin+ programs may create a number of windows, some of which might be open at the same time. A ClearWin+ program terminates when both a) the END point of the program (or its equivalent) is reached, and b) all windows created by the program have been closed by the user.
Normally the user is provided with a number of ways to close a window. There is usually a system menu with a 'Close' item (Alt+F4) at the top left of a window. Selecting this item is equivalent to clicking on the close box at the top right of a window. The programmer can use %cc (Control Closure) with a call-back function to trap this event.
a) When you click on the button that has no call-back function attached, the parent window will close. If there is only one window open, the effect is the same as if the standard 'EXIT' call-back were attached to the button.
b) If there is no call-back function attached to a button and the associated window has been created within a call-back function, then the window will close. The affect on the window's parent will depend on the value returned by the call-back (see Call-back functions). A zero return will close the window's parent. The same is true for any call-back, not just those attached to buttons.
Another approach to window closure is to attach a control variable to a window. When a window (or dialog) is created, by default it will be equivalent to a modal dialog box. A modal dialog box is one that must be closed before other windows in the same application can be accessed. Any code that follows the winio@ calls for a particular modal dialog box, will not be processed until the user closes the dialog.
If you want more than one window to be accessible (the equivalent of a modeless dialog box) then you can use %lw (Leave Window Open) (see Leave window open) to leave a window open and to attach a control variable to the window. The presence of %lw causes any code that follows the winio@ calls for a particular window to be processed immediately. ClearWin+ sets the value of a %lw control variable to -1 (minus one). If the control variable is subsequently set a non-negative value, the window will close when that variable is updated (see below).