Skip to main content

Visualization Element: Text Editor

Symbol:

_visu_img_text_editor.png

Category: Special Controls

The element shows the contents of text files that are saved on the controller. Files can be encoded in ASCII or Unicode formats. A visualization user can also edit the text.

Element properties

Are all element properties available?

All properties are available only after you select the Advanced option or the All categories filter in Properties.

Element name

Example: GenElemInst_1

Tip

Assign individual names for elements so that they are found faster in the element list.

Element Type

Text Editor

Position

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

X

The X-coordinate (in pixels) of the upper left corner of the element

Example: 10

Y

The Y-coordinate (in pixels) of the upper left corner of the element

Example: 10

Width

Specified in pixels

Example: 150

Height

Specified in pixels

Example: 30

Tip

You can also change the values by dragging the box _visu_icon_position_element.png symbols to other positions in the editor.

Font

Font name

Non-proportional font used by the visualization to display the contents of the file

Example: Courier New

Size

Font size

Example: 12

Control variables

File

Variable

Variable (STRING) for the file names and optionally the location of the file

It is located in the file system of the controller.

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

Open

Variable BOOL) for opening the file which is specified in the Variable property

Example: bOpen: BOOL;

TRUE: The file is opened.

In case another file is still open, then it is closed by setting the close variable (TRUE). The system will automatically clean up. However, any unsaved changes will be lost.

In a cycle, the open call is processed first and then the close call. When the triggering control variables are set simultaneously, the file is first opened and then immediately closed afterwards.

As soon as the Open or New flag is set, this action is executed during the next visualization cycle and the existing file name is evaluated. Both flags are evaluated in the same cycle and can therefore be set simultaneously.

Close

Variable (BOOL) for closing the file which is specified in the Variable property

Example: bClose: BOOL;

TRUE: The file is closed.

Note: In a cycle, the open call is processed first and then the close call. When the triggering control variables are set simultaneously, the file is first opened and then immediately closed afterwards.

Save

Variable (BOOL) for saving the file which is specified in the Variable property

Example: bStore: BOOL;

TRUE: The file is saved.

New

Variable (BOOL) for creating a new file with the name specified in the Variable property

Example: bCreate: BOOL;

TRUE: A file is created and opened.

As soon as the Open or New flag is set, these actions are executed during the next visualization cycle and the existing file name is evaluated. Both flags are evaluated in the same cycle and can therefore be set simultaneously.

Edit

Variable

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

Example: strFind: STRING := 'abc';

Find

Variable (BOOL) for performing the search for the string in the Variable property

Example: bFind: BOOL;

TRUE: The search is performed. The variable is automatically reset to FALSE.

Find next

Variable (BOOL) to start searching in the file

Example: bFindNext: BOOL;

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

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

Caret position

Line

Variable (integer data type) for the caret line

Example: iRowCursor: INT;

Column

Variable (integer data type) for the caret column

Example: iColumnCursor: INT;

Position

Output variable (integer data type) for the output of the absolute position of the caret in the text

Example: iPosCursor: INT;

Set cursor

Variable BOOL) for setting 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 actual values.

Note: The variable is used as the control variable for an input event triggered by a visualization user.

Selection

Start position

Output variable (integer data type) for the output of the absolute position where the text selection starts

Example: iPosSelection: INT;

End position

Output variable (integer data type) for the output of the absolute position where the text selection ends

Example: iPosEndSelection: INT;

Start line number

Output variable (integer data type) for the output of the line where the text selection begins

Example: iRowSelection: INT;

Start column index

Output variable (integer data type) for the output of the column where the text selection begins

Example: iColumnSelection: INT;

End line number

Output variable (integer data type) for the output of the line where the text selection ends

Example: iRowEndSelection: INT;

End column index

Output variable (integer data type) for the output of the column where the text selection ends

Example: iColumnEndSelection: INT;

Line to select

Variable (integer data type) for the line number which is selected

Note: The selection is controlled by the variables in the Trigger selection property.

Set selection

Variable (BOOL) to control 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.

Note

The 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 to occur in the visualization.

Error handling

Variable for error code

Variable (integer data type) for the error number in case of error

Example: iError: INT;

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

Variable for content changed

Variable (BOOL) for the output of the information whether the contents have changed

Example: bIsContentEdited: BOOL;

TRUE: The contents of the text editor have changed.

Variable for access mode

Variable (BOOL) for controlling the permission to the file

Example: bIsReadOnly: BOOL;

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

FALSE: A visualization user has read/write permission.

Note

The variable overwrites the setting in the Editor mode property.

Maximum line length

Maximum line length

Maximum number of characters per line

Editor mode

  • Read-only: A visualization user has read-only permissions to the file. At runtime, the file contents are highlighted in gray in the text editor.

  • Read/write: A visualization user has read-write permissions.

New files

Character 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: Customary for Windows systems

  • LF: Customary for UNIX systems

Note

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

Center

The properties contain fixed values for the coordinates of the point of rotation. The rotation point is displayed in the editor as the _visu_icon_center_point.png symbol and is used as the center for rotation and scaling.

Tip

You can also change the values by dragging the _visu_icon_center_point.png symbol to another position in the editor.

X

X-coordinate of the point of rotation

Y

Y-coordinate of the point of rotation

Absolute movement

The properties contain IEC variables for controlling the position of the element dynamically. The reference point is the upper left corner of the element. At runtime, the entire element is moved.

Movement

X

Increasing this value at runtime moves the element to the right.

Y

Increasing this value at runtime moves the element downwards.

Rotation

Variable (numeric data type) for the angle of rotation (in degrees)

Example: PLC_PRG.iAngle1.

The midpoint of the element rotates at the Center point. This rotation point is shown as the _visu_icon_center_point.png symbol.

At runtime, the alignment of the element remains the same with respect to the coordinate system of the visualization. Increasing the value rotates the element to the right.

_visu_img_prp_rotation.png

Scaling

Variable (integer data type) to trigger a centric stretching

Example: PLC_PRG.iScaling

The reference point is the Center property.

The value 1 shrinks the element by a factor of 0.001. The value 1000 returns the element to its original size.

Interior rotation

Variable (numeric data type) for the angle of rotation (in degrees)

Example: PLC_PRG.iAngle2.

At runtime, the element rotates about the point of rotation specified in Center according to the value of the variable. In addition, the alignment of the element rotates according to the coordinate system of the visualization. Increasing the value in the code rotates clockwise.

The rotation point is shown as the _visu_icon_center_point.png symbol.

Note

If a static angle of rotation is specified in the Position → Angle property, then the static angle of rotation is added to the variable angle of rotation (offset) when the visualization is executed.

_visu_img_prp_inner_rotation.png

Tip

You can combine the variables to a Unit conversion.

Tip

The X, Y, Rotation, and Interior rotation properties are supported by the "Client Animation" functionality.

State variables

The variables control the element behavior dynamically.

Invisible

Variable (BOOL) for toggling the visibility of the element

TRUE: The element is not visible at runtime.

Tip

The Invisible property is supported by the "Client Animation" functionality.

Animation

Tip

These properties are available only when you have selected the Support client animations and overlay of native elements option in the Visualization Manager.

Animation duration

Variable for the duration (in milliseconds) in which the element runs an animation

  • Variable (integer value)

    Example: Menu.tContent with VAR tContent : INT := 500; END_VAR

  • Integer literal

    Example: 500

. Animatable properties
  • Absolute movement, Movement, X, Y

  • Absolute movement, Rotation

  • Absolute movement, Interior rotation

  • Absolute movement, Exterior rotation

The animated movement is executed when at least one value of an animatable property has changed. The movement then executed is not jerky, but is smooth within the specified animation duration. The visualization element travels to the specified position while rotating dynamically. The transitions are smooth.

Move to foreground

Variable (BOOL) for setting the element in the foreground

TRUE: At runtime, the visualization element is displayed in the foreground.

FALSE: At runtime, the visualization element is displayed in the layer where it was inserted in the visualization editor.

Example: bIsInForeground with VAR bIsInForeground : BOOL := FALSE; END_VAR

Access Rights

Note

Available only when a user management is set up for visualization.

Access Rights button

Opens the Access Rights dialog. There you can edit the access privileges for the element.

. Status messages:
  • Not set. Full rights.: Access rights for all user groups : operable

  • Rights are set: Limited rights: Access is restricted for at least one group.