Execution modes

Spontaneous

You can write functions in scripts in such a way that a change in a data point attribute is automatically signalled to the function, which then runs. This might be useful, for instance, if a graphics object is meant to flash for a particular data point value. Functions of this type register an interest in those data point attributes for which a change in value is meant to call these functions.

Example

The previous example in the chapter Structure of CTRL scripts is such an instance. The script registers an interest in data points A and B with the Event Manager, and recalculates the value C every time the value of A and/or B changes. Thus the value of C is always calculated spontaneously. It guarantees that both A and B always contain the latest values when the recalculation is performed. The script is re-executed whenever the value of A or B changes, as long as its interest in data points A and B has not been deregistered.

User input

A second area in which scripts are used is in response to user inputs. For instance it is required that a script is always started if the user clicks on a button with the mouse. In this case script execution is not linked to a change in value of a data point attribute. The script is only executed once, and is not run again until the next mouse click. An example of such a script would be the opening of a panel by clicking on a button.

Terminating scripts

A script associated with a graphics element is terminated as soon as the panel containing the element is closed. This happens irrespective of other termination conditions provided for the script. Control scripts can run completely independently of the UIM using the Control Manager. If a Manager is closed (UI, Event, CTRL) then all its started scripts are terminated.