Configuration of a text editor
To access the control variables supported by the text editor, it is necessary to add an additional visualization element to the visualization and link it with the text editor via control variables.
The procedure is described below, using the example of the loading functionality of the text editor:
1. Declaration of the control variable for the element "Load" in IEC code in MAIN, for example:
PROGRAMM MAIN
VAR
bOpen : BOOL;
END_VAR
2. Declaration of the variable for the file name of the text editor in IEC code in MAIN, for example:
PROGRAMM MAIN
VAR
bOpen : BOOL;
sFileName : STRING;
END_VAR
3. Adding a rectangle element to visualization and its configuration:
- Texts → Text : Load
- Input configuration → Keys → Variable : MAIN.bOpen
4. Adding a text editor element to the visualization and its configuration:
- Control variable → File → File name : MAIN.sFileName
- Control variable → File → Open : MAIN.bOpen
All control variables that are present in the properties of the text editor can be linked on this way.
Error messages
To output the error text for the error number that is available in Control variable → Error handling → Variable for error number, program the function call VisuFctTextEditorGetErrorText() in IEC code:
1. Declaration of the required variable:
PROGRAMM MAIN
VAR
…
nErrorCode : USINT;
sErrorMessage : STRING(255);
END_VAR
2. Implementation of the function call:
sErrorMessage := VisuFctTextEditorGetErrorText(nErrorCode);
3. Output of the error message in the visualization, for example in a rectangle element with the following properties:
- Texts → Text : %s
- Text variables → Text variable : MAIN.sErrorMessage