Please enable JavaScript to view this site.

CWT User Interface Design Handbook

A property defined in a style can be overridden if the same property is defined in the control that uses the style. If the property FormattedText is set as “StyleText” in a style applied to a label, and the FormattedText property is set to “LabelText” for the label as well, the property definition for the label will override the style and the result is that FormattedText is set to “LabelText”.

Warning:
If the Click property is overridden for Button controls both the click action defined in the style and the click action set for the button will be executed. The click action in the style will be executed before the click action set for the button.

 

TFT displays

When overriding a style for a TFT display you must format the style in the following way:

<TFT:Label MxStyle='{SampleStyle}' Name='SampleLabel' FormattedText='LabelText'/>

The part MxStyle='{SampleStyle}' must always come first before any other parameter. As the line for a TFT display is read from left to right any parameter before the style parameter will be overridden by the content of the parameter. This a specially important for elements that have a special name that is not the same as the name in the original style.

Example for Stn:Label:

<Style def:Name='SampleStyle'>
  <StyleProperties>
    <PropertyStyle FormattedText='StyleText'/>
    <PropertyStyle Location='145, 0'/>
    <PropertyStyle Width='64'/>
    <PropertyStyle Height='14'/>
  </StyleProperties>
</Style>
 
<Stn:Label   Name='SampleLabel'
  FormattedText='LabelText'
  MxStyle='{SampleStyle}'/>

In this example the label will get “LabelText” as FormattedText since the style is overridden by the FormattedText set directly for the label.