Managing Dynamic Text in a Text List

In a text list for dynamic text you can manage, create and translate texts. A text you have written here can be selected in a visualization element in the property Dynamic texts. During operation the visualization outputs this text dynamically in the selected language.

You create a text list as an object in the PLC project tree. The text list contains a table with text list entries, which you can edit and expand. An text list entry consists of an ID for identification, the source text and its translations. You can add new text list entries to a text list. Menu commands are available for this purpose.

See also:

Creating an object Text List

1. Select a folder in the Solution Explorer in the PLC project tree.
2. In the context menu select the command Add > Text List...
The Add Text List dialog opens.
3. Enter a name.
4. Click on Open.
The text list is added to the PLC project tree and opens in the editor.

Structure of a text list

Symbol: Managing Dynamic Text in a Text List 1:

Managing Dynamic Text in a Text List 2:

ID

Unique text identifier

Standard

Source text as string, e.g. Information A

Double-click in the field to edit the text.

The table contains any number of language columns you may have added. A language column is identified with a language code, which you specified when you created the column with the Add Language command.

<language code>

Name of the language in the form of a language code, e.g. en-US. This column contains the translation of the text written under Default. Provided a language code is selected in the visualization manager, a visualization outputs the translated text during operation. If no translation has been entered, TwinCAT uses the text under Default. During operation a visualization can switch language, is requested by a user.

Empty line

You can edit the line to add your own text.

Creating a text list for dynamic text output

A project with visualization is open.
1. In the Solution Explorer, select the PLC project object or a folder below it in the PLC project tree.
2. In the context menu select the command Add > Text List.
3. Enter a name, for example "TextList_A", and quit the dialog with "Open".
An object of type Text List is created.
4. Click under the Default column and open the input field. Enter a text, for example "Information A".
The source text is created. It serves as a key in the table and as source text for translations.
5. In column ID enter any character string, for example "A".
6. Double-click in the empty line at the end of the table under Default and enter further text list entries.
The text list entries with source text and ID are defined. If you configure the property Dynamic texts for an element in a visualization, you can now select the text list “TextList_A”, for example, and assign the ID “A”.

Dynamic text output

In a visualization you can configure the dynamic output of texts that were written in a text list by configuring the property Dynamic texts of an element. You can assign a text list and an ID directly, or you can use IEC variables and set the values programmatically.

A project with visualization is open, and a text list exists in the PLC project tree.
1. Open the text list in the editor, for example "TextList_A".
2. Double-click the visualization object.
The editor opens.
3. Drag an element, for example of type Textfield, into the visualization.
4. Configure its property Dynamic texts, by selecting an element from the Text list property, for example “TextList_A”, and entering an ID from the text list in Text index, for example “A”. Pay attention to the quotation marks. You can also assign an IEC variable of type STRING for the text list name and the ID.
The IEC variables enable programmatic access to the texts of the text lists.
5. Compile the application, upload it to the controller and start it.
The visualization outputs the text from the text list in the text field: Information A.