Printing a dynamic text using a variable
Besides the automatically created global text list, there are also custom text lists.
If an element should dynamically display multiple texts one after the other, then a string variable is specified for it, not the text ID itself. The variable is then set programmatically (in IEC code) to change the text IDs. In this way, a dynamic text display in the visualization element is achieved.
In custom text lists, you can translate the default texts and add more languages when needed. If language switching is implemented for visualizations, then the translation is displayed at runtime for the configured text.
Image visualization element
Frame visualization element
Pie visualization element
Polygon, Polyline, and Bézier Curve visualization elements
Rectangle visualization element
Button visualization element
Scroll Bar visualization element
Table visualization element
Text Field visualization element
All texts about a topic (such as error handling) are listed in a text list.
The Text Field visualization element is configured for dynamic display:
The
strErrorHandling
variable is entered in the Dynamic texts element property under Text list.The
strHandlingID
variable is entered in the Dynamic texts element property under Text index.
A case distinction is implemented in the application code where the text for error handling is displayed depending on the error.
For this purpose, a text ID from the
ErrorHandling
text list is assigned to thestrHandlingID
variable depending on theiError
error.// Text list name strErrorHandling := 'ErrorHandling'; //Assigning text ID CASE iError OF 2: strHandlingID := 'ID_2'; 3: strHandlingID := 'ID_3'; 4: strHandlingID := 'ID_3'; ELSE strHandlingID := 'ID_1'; END_CASE;