Visualization Element ‘Text Editor’

Symbol: 6e4b7713f82f3517c0a8640e003bdebe_21c095076efb5197c0a8640e0169ceeb

Tag: Special controls

This element shows the contents of text files that are saved on the PLC. The files can be encoded in ASCII or Unicode formats.

A visualization user can also edit the text.

Element Properties

Element name Example: GenElemInst_1
Type of element textual editor

Element property ‘Position’

The position defines the location and size of the element in the visualization window. These are based on the Cartesian coordinate system. The origin is located at the upper left corner of the window. The positive horizontal x-axis runs to the right. The positive vertical y-axis runs downwards.

X

X coordinate of the upper left corner of the element

Specified in pixels.

Example: 10.

Y

Y coordinate of the upper left corner of the element

Specified in pixels.

Example: 10.

Width

Specified in pixels.

Example: 150

Height

Specified in pixels.

Example: 30

Note

You can also change the values by dragging the box symbols ( 6e4b7713f82f3517c0a8640e003bdebe_7b449e02d0393877c0a8640e01fd8c9e ) to other positions in the editor.

See also

Element property ‘Font’

Name

Unproportional font for displaying the file contents in the visualization.

Example: Courier New

Size

Font size

Example: 12

Element property ‘Control variables’

Element property Control variables ‣ File
Variable

Variable (STRING). Contains the file name and (optional) storage location of the file in the file system of the PLC.

Example: strFile: STRING := '/Documentation/Info.txt';

Open

Variable (BOOL). Controls the opening of the file that is defined in the Variable property.

Example: bOpen: BOOL;

TRUE: The file is opened.

Close

Variable (BOOL). Controls the closing of the file that is defined in the Variable property.

Example: bClose: BOOL;

TRUE: The file is closed.

Save

Variable (BOOL). Controls the saving of the file that is defined in the Variable property.

Example: bStore: BOOL;

TRUE: The file is saved.

New

Variable (BOOL). Controls the creation of a new file. The name is defined in the Variable property.

Example: bCreate: BOOL;

TRUE: Creates and opens a file.

Element property Control variables ‣ Edit
Variable

Variable (STRING). Contains the string to search for in the file.

Example: strFine: STRING := 'abc';

Find

Variable (BOOL). Controls executing the search for the string in the Variable property.

Example: bFind: BOOL;

TRUE: The search is performed.

Find next

Variable (BOOL). Controls the location to begin the search in the file.

Example: bFindNext: BOOL;

TRUE: The search begins at the last search result location.

FALSE: The search starts at the beginning of the file.

Element property Control variables ‣ Caret position
Line

Variable (integer data type). Contains the line of the cursor.

Example: iRowCursor: INT;

Column

Variable (integer data type). Contains the column of the cursor.

Example: iColumnCursor: INT;

Position

Output variable (integer data type). Returns the absolute cursor position in the text.

Example: iPosCursor: INT;

Set cursor

Variable (BOOL). Controls the setting of the cursor at a specific location.

Example: iSetCursor: INT;

TRUE: The cursor is moved. The new position is defined in the Line and Column properties.

FALSE: The Line, Column, and Position properties contain the current values.

Please note: This variable is used as the control variable for an input event triggered by a visualization user.

Element property Control variables ‣ Selection
Start position

Output variable (integer data type). Shows the absolute position for starting the text selection.

Example: iPosSelection: INT;

End position

Output variable (integer data type). Shows the absolute position for ending the text selection.

Example: iPosEndSelection: INT;

Start line number

Output variable (integer data type). Shows the line where the text selection begins.

Example: iRowSelection: INT;

Start column index

Output variable (integer data type). Shows the column where the text selection begins.

Example: iColumnSelection: INT;

End line number

Output variable (integer data type). Shows the line where the text selection ends.

Example: iRowEndSelection: INT;

End column index

Output variable (integer data type). Shows the column where the text selection ends.

Example: iColumnEndSelection: INT;

Line to select

Variable (integer data type). Contains the line number that is selected.

Please note: The selection is controlled by the variables in the Trigger select property.

Set select

Variable (BOOL). Controls the selection of a line.

Example: bSetSelection: BOOL;

TRUE: The line from the Line to select property is selected and highlighted in the text editor.

if the line is not in the current text segment of the text editor, then the text segment is moved to this line.

Please note: This variable is used as the control variable for an input event triggered by a visualization user. The control variable is not reset automatically. You are responsible for this happening in the visualization.

Element property Control variables ‣ Error handling
Variable for error code

Variable (integer data type). Contains the error code when an error occurs.

Example: iError: INT;

The error codes are declared in GVL_ErrorCodes in the VisuElemTextEditor library. For displaying the English error text, the VisuFctTextEditorGetErrorText() function of the library must be called.

Variable for content changed

Variable (BOOL). Shows whether the contents have changed.

Example: bIsContentEdited: BOOL;

TRUE: The contents of the text editor have changed.

Variable for access mode

Variable (BOOL). Controls the access privileges to the file.

Example: bIsReadOnly: BOOL;

TRUE: A visualization user has read-only permissions. In runtime mode, the file contents are highlighted in gray in the text editor.

FALSE: A visualization user has read-write permissions.

Please note: The variable overwrites the setting in the Editor mode property.

Maximum line length Maximum number of characters per line
Editor mode
  • Read only: A visualization user has read-only permissions to the file. In runtime mode, the file contents are highlighted in gray in the text editor.
  • Read/write: A visualization user has read-write permissions.

Element property ‘New files’

Encoding

Character encoding of the new file:

  • ASCII
  • Unicode (Little endian)
  • Unicode (Big endian)
New line character sequence

End of line character of the new file:

  • CR/LF: Normal for Windows systems
  • LF: Normal for UNIX systems

Please note: When a visualization user opens an existing file, the end-of-line character of the file is detected and used automatically.