ST Editor
The ST Editor is a text editor and is used to implement code in Structured Text (ST) and Extended Structured Text (ExST).
The line numbering is located on the left edge of the editor. When entering the programming elements, the function List components and the input assistant (F2) will help you. If the cursor is on a variable, TwinCAT displays information on the variable declaration in a tooltip.
You can perform a rectangle selection with the following shortcuts:
- [Shift] + [Alt] + [Right arrow]: The selected area will be extended one place to the right.
- [Shift] + [Alt] + [Left arrow]: The selected area will be extended one place to the left.
- [Shift] + [Alt] + [Up arrow]: The selected area will be extended one line upwards.
- [Shift] + [Alt] + [Down arrow]: The selected area will be extended one place downwards.
Zooming in the editor window is possible by turning the mouse wheel while holding down the Ctrl key.
You can configure the behavior (such as parentheses, mouse actions, tabulators) and appearance of the editor in the TwinCAT options in the category PLC Environment > Text editor.
For an incremental search for strings within the editor, use the shortcut [Ctrl] + [Shift] + [i] to open an input field at the bottom of the editor. As soon as you start typing a string, the editor highlights the corresponding occurrences in color. To the right of the input field is the number of matches found. Using the arrow buttons or the shortcuts [Alt] + [Page up] or [Alt] + [Page down] you can place the cursor on a found location.
When you place the cursor on a symbol name, all the places where the symbol is used within the editor are highlighted. The references correspond to the hits in the cross-reference list. For very large projects, this can lead to delays in the input. In this case you can disable the function in the options of the text editor.
TwinCAT recognizes syntax errors during the editing process and underlines the errors with a red squiggly line. Prerequisite is that the corresponding option is activated in the TwinCAT options, category PLC Environment > Smart Coding. Any syntax errors detected during the compilation are displayed in the Error list (View menu).
See also:
- Programming Structured Text (ST)
- ST Expressions
- Assignments
- Instructions
- TC3 User Interface documentation: Dialog Options - Text editor