Changing fill color property according to tag values
JMobile allows to change the color property of a widget dynamically, based on tag values in two ways:
- Using ColorPalette
- Connecting the Color property to a String type tag
Changing color property using ColorPalette
- Create the tag (internal or PLC) that you want to refer to for color management. The tag can be of any data type. On the basis of the value of this tag, the color will change.
- Attach this tag to the Fill Color property of an object (for example, a button).
- In the same dialog select the ColorPalette tab and add the colors that will be used for the object according to the tag value.
Note: The last used colors’ tables are saved and can be reused selecting them from the colors list box on the toolbar.
Changing color property connecting Color property to a String type tag
- Create the tag (internal or PLC) that you want to refer to for color management. On the basis of the value of this tag, the color will change. The tag must be of String type and the Arraysize property of the tag must be big enough to contain the string formatted as explained here.
- Attach this tag to the Fill Color property of an object (for example, a button).
- Write in the String tag the RGB color code of the required color. Use one of these formats:
- #XXYYZZ, Where XX, YY and ZZ are the RGB components of the needed color expressed in Hexadecimal format (range 00–FF).
- rgb(XXX,YYY,ZZZ), where XXX, YYY and ZZZ are the RGB components of the needed colors expressed in Decimal format (range 0–255).
Note: This feature can be applied to all the objects available in the Widget gallery that have a color property. The runtime change of the color is possible only thanks to the properties of the SVGs that are composing the object. This feature can not be applied to other image formats such as JPEG or BMP files.