Commands, Toolbar and Shortcuts in the Text Editor
The text editor provides specific commands to edit the code in textual worksheets. These commands are executed via context menu, toolbar buttons or keyboard shortcuts.
This topic contains the following sections:
Context menu
In addition to the standard editing commands such as Cut/Copy/Paste (shortcuts: <Ctrl>+<X>/<C>/<V>), etc., the context menu provides the following commands:
Command | Description | |
---|---|---|
Create New Variable | Creates a new variable for the text selected in the code worksheet. The variable declaration is added with the default settings to the local 'Variables' table. When declaring an external variable, the relating global declaration (with the 'Global' keyword) is automatically added to the 'Data List' of the 'IEC 61131-3' node provided that the respective POU is already instantiated in the controller (i.e., a program instance exists or an FB instance within a program instance).Depending on the edited POU type, different variable declaration keywords are provided for selection. See also topic "Variable Declaration Keywords" for details. | |
Insert Template | In ST: inserts a predefined code template. The submenu provides the templates that are allowed at the current cursor position. Also refer to the section "Statements in ST".In data type worksheets: inserts a predefined data type declaration syntax, e.g., for a user-defined array or struct data type. | |
Make Upper CaseMake Lower Case | Changes the currently selected text to capital or small letters. | |
Comment LinesUncomment Lines | You can use the command 'Comment Lines' to comment out a selected line or a range of text. The selected line(s) are prepended by the '//' characters (marked as single line comments). If no line or range is selected, the command is applied to the current line.The 'Uncomment Lines' command removes the first two '//' characters at the beginning of each selected line. If no line or range is selected, the command is applied to the current line. | |
Tabify SelectionUntabify Selection | 'Tabify' converts the spaces at the beginning of the selected lines to tabs. 'Untabify' converts the tabs at the beginning of the selected lines to spaces. The number of spaces can be defined in the 'Extras > Options' dialog in the 'Text Editor | Tabs' category with the 'Tab size' parameter. | |
Toggle Execution Value Mode | The command is only available in debug mode and if the corresponding extended debug settings were made in the Cockpit before writing and starting the project. The command is used to display execution values and the execution indication in the worksheet.Refer to the topic "Extended Debugging: Execution Values/Indication vs. "Normal" Online Values" for details. |
|
Toggle OutliningCollapse AllExpand All | These commands influence the ST code representation: You can enable/disable (toggle) the outline representation of the code and, if enabled, collapse or expand all outlined statements at the same time instead of using the ![]() ![]() |
|
Go To Line ... | Goes to a line number within the worksheet. The command opens a dialog box where you have to enter the line number. | |
Variable Properties | Shows or hides the 'Variable Properties' subeditor for the selected variable at the bottom of the code editor. In this editor, you can edit the properties of the variable (except its name) without leaving the code editor (you cannot create new variables in the table). | |
Go To Instance Editor | The command is only available in debug mode. It is used to select the instance for which online values shall be displayed.The submenu lists all instances of the worksheet executed on the controller in the format 'PLC.ProgramInstance' for program instances and 'PLC.ProgramInstance.FBInstance' for FB instances.After selecting an instance, the worksheet appears in debug mode showing the instance-related values read from the controller.
![]() ×‣ Monitoring/Debugging the Safety PLC ×‣ Monitoring Mode: Displaying Online Values ×" for further information. |
|
Go To Definition | Jumps to the declaration of this variable/FB instance in the 'Variables' table. | |
Go To Implementation | Calling this command for a selected user-defined function block directly opens the related function block editor group with the code worksheet containing the FB code. Only available for user-defined function blocks. |
|
Cross References | The context menu command is only available for variables and active if the cross references are collected and up-to-date (![]() |
|
Locate in Cross References | The context menu command is only available for variables and active if the cross references are collected and up-to-date (![]() |
|
Show all References | The context menu command is only available for variables and active if the cross references are collected and up-to-date (![]() For more details, refer to section "Showing cross references out of the code ..." in the "CROSS REFERENCES Window" topic. |
|
Refactoring | Opens the REFACTORING window in the Cross Function Area. The window shows all references of the object for which the command was executed. Using the window, you can perform an automatic solution-wide replacement of variable properties.For more details, refer to the topic "Refactoring Variables". |
Toolbar and shortcuts
The toolbar located at the top of the textual worksheet provides access to the frequently used commands. Each toolbar button provides a tooltip that shows a short description of the command and, if available, the predefined keyboard shortcut.
Toolbar button | Keyboard shortcut | Description |
---|---|---|
![]() | <Ctrl>+<L> | Goes to a line number within the worksheet. Pressing the button opens a dialog box where you have to enter the line number. |
![]() | <Ctrl>+<Shift>+<U> | Changes the text in the current selection to uppercase. |
![]() | <Ctrl>+<U> | Changes the text in the current selection to lowercase. |
![]() | - | The command is only available in debug mode and if the corresponding extended debug settings were made in the Cockpit before writing and starting the project. The command is used to display execution values and the execution indication in the worksheet.Refer to the topic "Extended Debugging: Execution Values/Indication vs. "Normal" Online Values" for details. |
![]() | - | Comments out a selected line or a range of text. The selected line(s) are prepended by the '//' characters (marked as single line comments). If no line or range is selected, the command is applied to the current line. |
![]() | - | Uncomments a selected line or a range of text. The first two '//' characters at the beginning of each selected line are removed. If no line or range is selected, the command is applied to the current line. |
![]() | - | Converts the spaces at the beginning of the selected lines to tabs. The number of spaces can be defined in the 'Extras > Options' dialog in the 'Text Editor | Tabs' category with the 'Tab size' parameter. |
![]() | - | Converts the tabs at the beginning of the selected lines to spaces. |
![]() | - | Enables/disables the outline representation of the code. |
![]() | - | Collapses all outlined statements. (Command is only available if the outline representation is enabled.) |
![]() | - | Expands all outlined statements. (Command is only available if the outline representation is enabled.) |
![]() | Locate in Cross References | The context menu command is only available for variables and active if the cross references are collected and up-to-date (![]() |
![]() | Show all References | The context menu command is only available for variables and active if the cross references are collected and up-to-date (![]() For more details, refer to section "Showing cross references out of the code ..." in the "CROSS REFERENCES Window" topic. |
![]() | Show Variable Properties | Shows or hides the 'Variable Properties' table at the bottom of the code editor. In the table, you can edit the properties of variables (except their name) without leaving the code editor (you cannot create new variables in the table). |
![]() | <Ctrl>+<F><Ctrl>+<H> | Opens the search/replace bar which allows you to search and replace text in the active worksheet.Pressing <Ctrl>+<F> opens the bar with the 'Find what' field focused and <Ctrl>+<H> opens the bar with the 'Replace' field focused. |