Setup()

Setup()

Type: REGULAR FUNCTION

Purpose: Displays a dialog box where the user can modify, save, or recall script parameters.

The dialog box has a title which is specified by the function call. It may have a variable number of parameters. When Setup() is executed, a dialog box opens.

All items in a Setup dialog box must be objects with a Dialog license. A License Error appears if you give Setup an argument that does not have this license. Simple data types (STRING, REAL, etc.) are invalid arguments. Refer to the individual class descriptions for Dialog license details.

Each object is displayed as a prompt and one or more fields which you may modify. Each object in Setup() determines how the fields are displayed based on its dialog license. The object specifies the prompt to be used to identify itself.

The prompt can have an accelerator key. The accelerator key is shown as an underlined character in the prompt. When the accelerator key is typed simultaneously with the ALT key, the focus of the window switches immediately to the object associated with that accelerator. Accelerator keys are identified by an ampersand (&) in the prompt for an object. For example, the sample period object can be created by the following function:

Sample = QUANT.New(“SAMPLETIME”, 0.5, “Sa&mple Period (s)”)

The prompt contains an ampersand before the m in the prompt “Sa&mple Period (s)”. When this prompt is shown in a Setup dialog box, the m is underlined. More importantly, the Setup() function automatically sets up ALT + M as the accelerator for this object.

Avoid use of the following characters as accelerators: R, O, S, C, D, N. These accelerators are already used in Setup() as accelerators for push-buttons. All other letters can be used. If you run out of letters, repeat one. In this case, the accelerator cycles among all objects using this accelerator key.

When you click the Save key, the objects in the Setup dialog are all saved to a Parameter Set stored in a Parameter File. The TAG field of each object is used as a parameter identifier in the Parameter File.

The return value from Setup depends on the key you click to exit the dialog box. Setup returns TRUE if the user leaves via OK, and returns FALSE if the user leaves via CANCEL.

Usage: Status = Setup(Title, Item1, Item2, Item3, ….)

  Title STRING The title of the Setup dialog box.
  ItemN OBJECT

Object of any class having a Dialog License.

  Status BOOL

TRUE if user clicks OK button to end Setup()

FALSE if user clicks CANCEL button to end Setup().

Related Topics Link IconRelated Topics