...
Local variables are variables , that are valid within a picture instance. It means that the same picture , opened on several consoles (processes the D2000 HI processes) at the same time, and uses its copies of local variables. Local variable variables are visible only within the picture script, in they are not available on the system level are not available. They can be connected to graphic object objects and Windows controls.
There are four five categories of picture local variables:
- Basic local variables – they have no special features and can be connected to object objects and manipulate the object value.
- Input-output local variables – they allow to give parameters to the picture opened from other picture in both directions.
- Reference local variables - they are used for the identification of graphic objects and Windows controls. Such variables are used as unique unambiguous identifiers of these objects within the picture script.
- Indexed - they are used to handle current the currently displayed row of structured variable variables connected to graphic object objects to view.
- External - similar to Basic local variables, but the parameters can be set from a parent picture
Configuration of local variables
...
Clicking the button from the Main toolbar opens the dialog box allowing you to configure local variables.
...
Image Added
Definition The definition of a one local variable consists of the following attributes:
First column | The column is used to select a given local variable in the list. Double-click on the column |
corresponds variable variables or name or definition |
conflictconflicts. |
Second column | Shows how many times it is used in graphic objects of the picture (not in the picture scripts); does not apply to the INOUT category. |
Variable name | Local variable name. The name can be used either for connection to the picture graphic object or in the picture script. The name must |
begins begin with the character '_' (underline). |
Value type | Local variable value type. Possible types: - BOOL - binary, logical variable
- INT - integer variable
- REAL - real variable
- TIME - variable of Absolute time type
- TEXT - text variable
- STRUCT - structured variable
|
Value | The attribute is valid only for reference variable and defines its value for use in the picture script. |
| Category of the local variable. According to the selected category, local variables in the list are shown in corresponding colors:- Image Modified LOCAL - basic local variable
- Image Modified INOUT - input-output local variable used for passing parameters between pictures
- Image Modified REFID - reference local variable used for object identification in picture script
- Image Modified INDEX - indexed local variable that specifies a row of structured variable
|
Value types | Local variable value type. Possible types:- BOOL - binary, logical variable
- INT - integer variable
- REAL - real variable
- TIME - variable of Absolute time type
- TEXT - text variable
- STRUCT - structured variable
|
Structure | The attribute is valid only for the value type STRUCT and defines the object of Structure definitiontype, |
that which determines the type of structured local variable. The attribute is also valid for index local variable that handles a filter (detailed description in index local variables below). |
Value | - it defines, for reference variable, its value for use in the picture script.
- it is a start value for local and external variables
|
Filter type |
Filter - filter type of index local variable (detailed description in index local variables below).
- parameters for local and external variables:
- No start value - without a start value
- Passive - a passive start value - it is only set when opening the picture
- Active - an active start value - when clicking above visible, not forbidden graphic object which uses the local variable for displaying, the value of the intern identifier of the object in the D2000 presented by MyValue expression is set automatically. This value can be used in display palettes using MyValue expression in status script of a palette row.
|
Status text | Object of Status text type |
, that will be used for displaying the value of the local variable when it is connected to a graphic object. |
Text palette | Mask definition from transformation palette for value types INT, REAL, and TIME from LOCAL and INOUT categories. |
Note: Items without meaning are unavailable and are marked with ---
Use of local variables
...
connect connection to graphic objects / Windows controls. Connection is being performed in the palette Connect object - the tab Connect, Palettes, Control... Using such a connected local variable allows |
to read modify modifying the object contents and changing the variable value. |
| They are used for parameter passing among pictures. Among pictures they are paired by name - when a picture is being opened from the mother picture, the contents of the mother picture variables is copied into input-output variables with the same names in the opened picture. Before closing the new picture, new contents of the input-output variables is copied to the corresponding mother picture variables. |
| They are used to name (identification) objects. There are three cases, you need to identify an object: - when you need to call an object function
- when you define an object event handler
- when you detect the event source in generic event handler
|
|
| - e.g. %HI_SetText(_N1, "Text") - e.g. ENTRY N1_OnClick
- e.g. ENTRY OnClick(IN INT _RefID) IF _RefID = _N1 THEN |
|
| They are used to handle |
current the currently displayed row of structured variable connected to graphic object to view. Handling the value of indexed variable from the picture script you can change current connected structure row. The change of value in the picture ensures the change of value of variable but not the connected row of structure. Index variables can handle so-called filter. Filter allows optimization of the communication between the |
processes D2000 Server and D2000 HI processes by the distribution of the values of the row defined by the indexed variable and not the values of whole structured variable. In |
the this case, the indexed variable must be bound with |
an a structured variable using the attribute Structure. Filter type is defined in the attribute Filter type: - No filter - filtering is disabled - there are distributed value changes of all rows.
- Passive - filtering is enabled. Initial value of the indexed variable is not defined - it must be initialized in the picture script. While no value of the indexed variable is defined no change of filtered structured variable is not distributed.
- Active - filtering is enabled. Initial value of the indexed variable is automatically set according the picture instance. After opening the picture, the distributed value of the filtered structure row is according the picture instance number.
When the filtering is enabled, value distribution can be also handled by the functions %HI_OpenRow, %HI_CloseRow, %HI_ChangeRow. |
External variables | Parameters of values of external variables can be set from a parent picture, which displays this picture in visual display unit as a subpicture. When setting parameters from a parenting picture, it is possible to bind on such external variables other variable. Then, the external variable represents the value of this bound variable. Anz change of the bound variable will reflect into value change of the external variable. The binding applies in both directions, so the change of the external variable will cause change in the bound variable. The external variables are typically used when the picture is used as a component. It is possible to connect the external variables to graphic objects in the same way as the basic variables. |
Note:
List The list of local variables is sorted first by category (the column Category) and then by name (the column Variable name). Dialog box of local variables keeps the last sorting when it is reopened.
When a conflict is occurred occurs (see the chapter Inserting graphic objects from clipboard into picture), the list is sorted only by name.
Clicking on the header of some column columns classifies the list downwardlydownwards, next clicking classifies it upwardlyupwards.
When the local variable is editing edited from the Connect object palette, tab Script, the appropriate row in the dialog window of local variables is highlighted by color highlighted (gray color).