Animating Textboxes to show Values
You can animate the Format, Text, and Value properties to allow a text box to display values or text strings. The three properties have different purposes:
- Format—The Format property represents the type of formatting that is applied to any value that is shown in the text box. This only has an effect when the text box's Value property is animated.
The Format property is not usually animated (the format is set on the Text Properties window instead). Typically, if the Format property is animated, it is associated with the Format property of a point so that the text box uses the same formatting as has been defined in the point's configuration. To do this, you would use the browse feature of the Expression window to associate the Format property of the text box with the Format property of the point.
You can also enter a string to animate the Format property. The string has to include the format rules and use the relevant syntax. For example, for the Format to be animated to show a numeric value to 3 decimal places, the string has to include:
#.000
For information about the syntax for format definitions see FORMATVAL in the Geo SCADA Expert Guide to Expressions.
- Text—The Text property represents a string. By animating this property, you can set the text box to display a defined string or value, or you can associate it with the value of any property in the database, for example, the CurrentStateDesc of a point.
If you enter a text string in the expression for the Text property, the text string has to be enclosed in single straight quotation marks. For example, if you enter 'State Display' as the expression, the text box will display:
State Display
If you enter a number, there is no need to enclose it in single straight quotation marks ' '.
If you use the Expression window to associate the Text property with the property of a database item, the value that is shown in the text box will not use any formatting settings. Typically, you would associate the Text property with a text value such as a point's CurrentStateDesc so the formatting would not be irrelevant (text does not use formatting). However, for numerical values, you may need formatting such as a specific number of decimal places. If formatting is required, you should you should animate the Value property instead of the Text property.
- Value—The Value property represents a numerical value or a text string that uses formatting settings. By animating this property, you can set the text box to display a defined string of characters or the value of any property in the database. The Formatting settings are defined for the value in the Point configuration or are set as an animation (see Format).
If you enter a string in the expression for the Value property, the text string has to be enclosed in single straight quotation marks. This works in the same way as strings that are used when animating for the Text property.
If you enter a numerical value, the number does not have to be enclosed by single straight quotation marks.
If you use the Expression window to associate the Value property with the property of a database item, the text box will display the text string or numerical value for the selected property and will apply any formatting settings, for example, a specific number of decimal places. If there are no formatting settings specified, the default settings are applied (2 decimal places, no leading zeros and so on).
If a text box is used to present a value from the database, such as the value of a point, you need to size the text box appropriately. The text box needs to be large enough to display the entire value, including any prefixes or postfixes. If the text box is too small, parts of the value may not be visible.
To see how the Format, Text, and Value animations work:
- Create a text box on a Mimic.
- Access the animations window for the text box.
- Enter the following expression for the Format property:
'#.000'
This expression specifies that any animated value that is shown in the text box uses three decimal places.
- Animate the Text property so that it is associated with the CurrentValue property of an internal analog point.
- Close the animations window and display the Mimic in Run Mode.
- Display the Database Bar (see Display an Explorer Bar).
- In the Database Bar, right-click on the analog point that is used to animate the Text property, then select the Hand Control option.
The Hand Control window is displayed. - Hand Control the point value so that it is 5.65890068
On the Mimic, the text box shows 5.65890068, as the text box has its Text property animated to show the value of the point. The Text property does not use the formatting settings (as defined in the expression for the Format property) and so shows the hand controlled value in full.
- Display the Mimic in Design Mode.
- Access the Animations window for the text box.
- Select the Text property.
- Select the Clear button to remove the Text animation.
- Animate the Value property so that it is associated with the CurrentValue property of the internal analog point that was previously associated with the Text property.
- Close the Animations window and display the Mimic in Run Mode.
The text box displays 5.659 as the 3 decimal places formatting that is defined by the Format animation is applied to the Value animation.