Attribute 'hide'
The pragma prevents variables or program elements from being displayed in the TwinCAT interface. In online mode they are then not visible in the input assistant or in the declaration part, for example, they cannot be found using the cross-reference search, and no debugging functions (such as stepping or breakpoints) can be applied to them.
Note that variables declared with the 'hide' or 'hide_all_locals' attribute cannot be saved as persistent. Furthermore, the generation of the associated process image (allocated inputs/outputs) is prevented for "hidden" variables. Furthermore, no (ADS) symbols are generated for these variables. In other words, symbolic access is prevented.
The effect of 'hide' also affects variables and signatures within libraries that exist as .library.
Syntax: {attribute 'hide'}
Insertion location: Line above a signature, line above the declaration line of a variable (only the variable directly following the pragma is rendered invisible here) or, in the case of ST actions/transitions, directly at the start of the action/transition
Sample:
The function block FB_Sample uses the attribute {attribute 'hide'}:
FUNCTION_BLOCK FB_Sample
VAR_INPUT
nA : INT;
{attribute 'hide'}
bInvisible : BOOL;
bVisible : BOOL;
END_VAR
VAR_OUTPUT
nB : INT;
END_VAR
In the main program an instance of the function block FB_Sample is defined.
PROGRAM MAIN
VAR
fbSample : FB_Sample;
END_VAR
While an input value for fbSample is implemented, the function List components, which opens when typing "fbSample." (in the implementation part of MAIN) shows the variables nA, bVisible and nB, but not the hidden variable bInvisible.
The pragma hide_all_locals can be used to hide all local variables of a declaration. |
If the pragma "hide used in compiled libraries for variables and signatures" is used, these variables and signatures are not displayed in the library manager. |
See also: