Color data

The ColorSymbol attribute can be bound to different symbols. To avoid inconsistencies between the output color value and the data type of the symbol, the Color Control reads the type of the symbol and tries to automatically derive the correct return type.

For example, if three color channels are to be displayed, but an array of type TcVnVector4_LREAL is linked in the PLC, these types do not match. The Color Control automatically recognizes this and writes an array with four values instead of three into the symbol, so that no error occurs. The rest of the channel is left empty.

The read-only attribute ColorValue is used to make the color programmatically accessible without binding a symbol to the property ColorSymbol. Other than that, there is no difference. It is possible to use both versions at the same time. Please note that ColorValue also outputs the data type of the symbol that is bound to ColorSymbol.

The attribute SliderValueUpdate is used to specify whether the color symbol should be updated during onChanged or at the end of onConfirmed of an interaction with the sliders. If the color value is changed during a slider movement (onChanged) and a symbol is bound to the attribute ColorSymbol, it can happen that the value jumps back to an older value after the slider is released. If this behavior is not desired, SliderValueUpdate should be set to onConfirmed .

In analogy to the property ColorValue, the method SetColorValue provides a way to set the color values of this control without linking a symbol with the property ColorSymbol.

The two ways of accessing the color value are explained in the following samples:

The example Conversion to HMI color object shows how the color data can also be used for other use cases.