Making Text Lists Dynamic
The text list entries can be made dynamic with help of the 'Text list' dynamic or 'Action on Click' dynamic assigned to an HMI object. This allows to select the displayed text from a text list at runtime by changing the program variable connected to the dynamic.
This topic describes how to make text list entries dynamic using the 'Text list' dynamic. For details about the 'Action on Click' dynamic and how to connect it to a text list using the 'Write text list value' action, click here.
The following procedure assumes the following:
- You have created a text list with several text list entries and value ranges as described in the topics "Creating and Managing Text Lists" and "Editing and Filtering Text Lists".
- The project contains a numeric variable (integer or floating point) or an HMI tag of type INT or REAL/LREAL.
- The project contains an HMI page.
Proceed as follows:
- Insert an object containing a label text (for example, a 'Text' or 'Check Box' element) into the HMI page.
- Click the 'Dynamics' tab in the properties window of the object. If the properties window is not visible, right-click the object and select 'Show/Hide Settings' from the context menu or click the in-place button.On the 'Dynamics' tab, click the 'New Dynamic' button at the top of the tab and select the 'Text > Text list' dynamic.
- Connect a numeric variable (integer or floating point) to the dynamic. To do so, click the input field right of the 'Variable' field and select a variable. The value of this variable determines which text is displayed in the HMI object when executing the HMI application. Depending on the value of the configured variable, the text entry from the associated text list is displayed at runtime.When binding a floating point variable or HMI tag of type REAL/LREAL to the 'Text list' dynamic, the 'Integer converter strategy' field is additionally shown. Here you can set whether the variable value is truncated or rounded before it is used as source value.
- Connect the text list to the dynamic. To do so, click the input field right of the 'Text list' field and select the text list from which a text entry is displayed (the field provides all text lists for selection you have created in you project).