State: modelled. Checked on every declaration of the TwinCAT and TcUnit fixtures (94 object files, 493 declarations, 2216 rows; over 10,000 cell edits each changing exactly that range of the file), Linux only. No table-edited object file has been opened and built in TwinCAT XAE.
Open the table
Run Open Declaration as Table from the Command Palette or the editor title of a .st file or a TwinCAT object file, or use Reopen Editor With > Declaration Table. Open Declaration as Text goes back.
Every variable section becomes rows: VAR, VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT, VAR_GLOBAL, VAR_TEMP, VAR_STAT, VAR_INST, VAR_EXTERNAL, with CONSTANT, RETAIN, PERSISTENT or NON_RETAIN, and every STRUCT and UNION. In a TwinCAT object, each declaration of the object, its methods, properties, accessors, actions and transitions has its own rows. Columns: scope, name, type, initial value, address (AT %I*), attributes (the {attribute ...} lines above) and comment.
Edit
| Key or command | What it does |
|---|---|
| Arrows | Move between rows |
| Enter or F2 | Edit the focused cell; only that cell's text changes |
| Escape | Restores the field |
| Add Variable | Asks for the section, the name and the type, then writes a new line with the indentation, spacing, column alignment and comment style of the nearest declarations |
| Remove Variable (Delete) | Removes the declaration with its attribute and comment lines |
| Move Up (Alt+Up), Move Down (Alt+Down) | Move the declaration with its attribute and comment lines |
| Show in Text | Opens the text with the declaration |
Adding or clearing an initial value, address or comment inserts or removes only that part.
How the table and the text stay one
- The table is a view of the text editor's own model. It follows typing, and Undo and Redo work in either view. Saving is the file's normal save.
- In a TwinCAT object, only that
<Declaration>changes; the XML and GUIDs stay. - A field writes to the row it was filled from, found again by its section and name. If that row is removed, renamed or changed in the text meanwhile, the write is refused and what you typed is kept.
- An edit computed from a reading the text editor has since changed is refused, and the table reads the text again.
What is read only or refused
- A declaration over several lines, with a comment or pragma inside it, a nested comment after it, inside
{IF} ... {END_IF}, or sharing its line with other text is a read-only row showing its text, never rewritten. - Names that are keywords or already declared in the unit are refused.
- Values that would leave their cell (a
;or:=in a type, a comment in a value) are refused. - Moving a declaration to another section is done in the text.
Not verified
- XAE opening and building a table-edited object file.