Window Events

The EVENT-CONTROL-HANDLE and EVENT-CONTROL-ID values will always be zero (NULL) when a window event occurs. The values returned are stored as signed integers and may return negative values.

Note: Command events begin with the prefix CMD. Notification events begin with NTF, and messages begin with MSG.

CMD-CLOSE (value 1)

This event indicates that the user has selected the Close option from the active window's system menu. The application should respond by hiding or destroying the window. The EVENT-WINDOW-HANDLE data item will contain the handle of the window that the user wants to close. The EVENT-DATA-1 and EVENT-DATA-2 values are not used. Note that floating windows always return the exception CMD-CLOSE. Also note that the run-time configuration variable QUIT-MODE affects only the main application window. All other windows in the application return the event CMD-CLOSE when the Close button is clicked.

CMD-ACTIVATE (value 6)

This event occurs when a window is activated by the user, but only if the previously active window belongs to the same program (that is, the user switches windows within the program, and does not transfer control from another program). The normal response is to ACCEPT something in the newly active window, making it the active window from the program's point of view. If you use either the LINK or BIND TO THREAD options when creating the window, the run-time system can automatically handle this event. The EVENT-DATA-1 and EVENT-DATA-2 values are not used. Threads are discussed in detail in Multiple Execution Threads in the ACUCOBOL-GT User's Guide.

NTF-RESIZED (value 4114)

This event occurs when a resizeable window that does not have AUTO-RESIZE specified is resized by the user. The application typically reconstructs the screen in response. EVENT-DATA-1 contains the new height and EVENT-DATA-2 contains the new width, both measured in hundredths of cells (for example, an 80-column-wide screen is expressed as 8000). Alternatively, after the ACCEPT terminates, you can use a format 2 INQUIRE statement to obtain the window's dimensions and other information. See INQUIRE Statement in Procedure Division Statements of the ACUCOBOL-GT Reference Manual.

The resize layout manager can simplify the task of resizing controls in a window that has been resized. For more information, see Layout Managers.

MSG-CLOSE (value 16415)

EVENT-ACTIONThis event occurs when the user clicks on the window's Close box, clicks Close from the window's system menu, or types the host system's key sequence to close the application (Alt-F4 for Windows).

MSG-CLOSE provides a single point at which you can test for the close operation. This event will be followed by the normal close sequence for the window. Handling of the initial window is dictated by the current setting of the QUIT-MODE configuration variable. This may also result in the generation of a CMD-CLOSE event for the other windows. If you set EVENT-ACTION to EVENT-ACTION-FAIL in response to this event, the close operation is inhibited.