WindowClose

Description: Returns true if an attempt to close the window is made.
Returns: Boolean
Usage: Steady State only.
Function Groups: Window
Related to: VStatus | Window | WindowOptions
Format: WindowClose(Object)
Parameters:  
Object   
Required. Any expression that returns the object value of any module instance drawn in the window.
Comments: If this function is active when an attempt to close a window is made, the window will not close, and the module(s) in that window will not stop. It is up to the calling module to close the window and stop the module(s) by switching to another state.
This function may be used to control what happens when a window is closed (or to prevent it from being closed). When the attempt is made to close the window, an action (or actions) can be triggered. For example, this might write some data to file. Then a variable could be set (or a value could be returned by the module) which signals the calling module to switch states, which closes the window and stops the module(s) inside.

It is possible for a WindowClose statement to be associated with a window, but to not yet be running when the attempt to close the window is made. If this happens the slay of the module running in the window will continue up the module tree until a running WindowClose is found, or the top of the tree is reached. This behavior may be undesirable. The scenario can be avoided by setting bit 19 of the Style option in the Window statement. Doing so will warn VTScada that a WindowClose statement will be associated with this window.

Example:

If ZButton(110, 240, 200, 270, "CANCEL", 1) ||
           WindowClose(Self()) CloseEverything;

This statement causes a state change to CloseEverything if the Cancel button is selected.