ContentsIndexPreviousNext

6.2 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 start 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 runtime 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 (i.e., 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, then the runtime can automatically handle this event. The EVENT-DATA-1 and EVENT-DATA-2 values are not used. Threads are discussed in detail in chapter 6, Book 1, "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 (e.g., an 80-column wide screen is expressed as "8000"). Use the INQUIRE verb to obtain the new dimensions.

MSG-CLOSE (value 16415) This event occurs when the user clicks on the window's close box, selects "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 where 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.