Obtaining User Input

VTScada provides a range of tools to help you watch for user input, whether to request information or to respond to control events. Choose the appropriate tool for the task. For much application development work, it is far easier to use the widgets in the Idea Studio than to write a user interface from scratch.

As well as considering how to gather user input, think about how that information will be used and if it needs to be saved, then how. Screens for user input, whether pages or custom windows, tend to come and go, meaning that the state and probably the module containing the page or window will end. If the information gathered from the user should persist, the values should be written to I/O tags, stored on disk as persistent variables, written to a file, or (rarely) the variables might be declared in a service that continues to run.

Note that a set of tools exists explicitly for building dialog boxes for tag configuration: These are the so-called, "P-tools", where "P" refers to "parameter editing".

If creating a configuration panel for a tag, use only the P-tools to gather user-input.
For all other purposes, do not use the P-tools.

Tab order between user input controls follows their z-order (that is, the order of the statements within the state), rather than their Focus ID value.

Mouse Input - Buttons, Target, etc.

Several VTScada functions are designed to accept input from the user via the screen pointer (mouse). Some, such as Pick, WinButtonandZButtonare designed to watch for click actions. Others, such as Target, XLocand YLocsimply watch the location of the pointer and can be used to trigger an action when the operator moves the pointer to a defined area.

All the GUI-graphics commands (GUIButton, GUIBitmap, etc.) are designed to watch for mouse input, and will return a numeric value indicating which combination of mouse buttons were used when an operator clicks on the graphic.

To use these functions, they must be placed in a module that is contained in a window, whether that is an application page, or a module of your own creation. They can be used as the trigger condition of an action to allow scripts to be executed when an operator clicks within a specified area.

Example:

If ZButton(10, 70, 110, 40,
           "OK" { Text label on button }, 
           1 { Focus ID }) ; 
[

...

]

This statement will cause the script to execute in response to a left-click on a button.

Selection Input

Selection tools are those that provide a set of options to a user. In the Idea Studio, widgets include the Droplist. Options that you can create using code include RadioButtons, DropList , WinComboCtrl and CheckBox , all of which are examples of selection input. Also in this group are tools such as the VTScada ColorSelect , Listbox and SpinBox.

Keyboard Input

Keyboard input may be used to allow an operator to respond Y (Yes) or N (No) in response to a prompt. It is also used whenever there is a need to prompt for a numeric or text value.

The most commonly used keyboard functions are MatchKeys, andWinEditCtrl. MatchKeys is typically used to trigger an action when a specified key or sequence of keys is pressed. It does not display the keystrokes entered.

The ZEditField function is used to accept text entered by the operator. Before typing, the operator must activate the object by clicking on the area of the window where the graphic is displayed, or by pressing the TAB key to set the focus to that input object.