Language Reference Guide : Events : WindowClose Event
 
Share this page          
WindowClose Event
The WindowClose event is triggered for the frame when the user selects the window manager close operation (for example, the Close option from a system menu) for the active frame. When the user closes a window, OpenROAD usually triggers both the WindowClose and Terminate events for the frame. However, by executing resume in the WindowClose event block, the Terminate event is not triggered. For more information, see Terminate Event.
This event has the following syntax:
on windowclose
The following attribute of the FrameExec class can be used in the WindowClose event block:
InputFocusField
Specifies the field with the current input focus
Use the CurFrame system variable to access this attribute. For more information, see FrameExec Class.
Usage: This event is defined only for the frame as a whole.
You can use the WindowClose event block to keep a window open. If you execute a resume statement in a WindowClose event block, the statement purges the Terminate event from the event queue and the window is not closed. This behavior differs from the Terminate event block, which closes the window as soon as the event block completes. For this reason, OpenROAD always processes a WindowClose event block, if specified, before a Terminate event block. It is not necessary to specify either event to close the window.
The WindowClose event is often paired in the event block with the standard close option from the frame's menu:
on windowclose,
on click menu.file_menu.close_menu =
begin
    if(/* conditions for validation fail */) then
        resume;
    endif;
end
More information:
InputFocusField Attribute