Member attributes: VariantCond

This attribute determines the condition to activate a particular variant member.

Syntax

true

false

$composer

$prototyper

profile‑name, ...

style‑name, ...

Discussion

The attribute VariantCond specifies the condition, when a particular class, autoobject, constant, bitmap resource or font resource variant member overrides actively the original member referenced in its corresponding attribute VariantOf. The attribute expects a list of , (comma) separated profile and style names, the built-in macros $composer and $prototyper or the boolean literals true and false. Depending on the operands the condition is fulfilled if:

Operand

Description

true

The condition is always true regardless of any other operand specified in the attribute. The variant is considered as being permanently active. In other words, the original member is overridden statically.

false

The condition is always false. If there is no other , (comma) separated operand specified in the attribute, the variant is considered as being permanently inactive. In other words, the variant has no effect on the original member and is automatically excluded from the code generation.

$composer

The condition is true or false depending on whether the affected variant is evaluated in context of the Composer window or not. Accordingly, when using $composer the variant is taken in account only when you work in the Composer window. Consequently, the variant is considered as being permanently active overriding the original member statically.

$prototyper

The condition is true or false depending on whether the affected variant is evaluated for the prototyping environment or during the code generation. Accordingly, when using $composer the variant is taken in account only when you test the application in the Prototyper or edit the application in the Composer window. Consequently, the variant is considered as being permanently active overriding the original member statically.

profile-name

The condition is true only when generating code for the corresponding profile. In such case the variant is considered as being permanently active. In other words, the original member is overridden statically. Otherwise if the condition is not fulfilled and there is no other operand specified in the attribute, the variant is considered as being permanently inactive. In other words, the variant has no effect on the original member and is automatically excluded from the code generation.

style-name

The condition is true only if the corresponding style is currently active. Styles can be activated and deactivated individually at the runtime by modifying the global variable styles. The variant is thus considered as being dynamic able to become active dynamically at the runtime.

Modify the attribute

To inspect or modify the value of a VariantCond attribute, select first the affected class, autoobject, constant, bitmap resource or font resource variant member. Thereupon, the attribute is listed in the middle area of Inspector. Please note the available assistant you can activate by clicking on the button right to the attribute. The assistant lists all profiles and styles you can choose individually by clicking on the corresponding checkbox. Deactivating all checkboxes in the assistant results in the attribute being initialized with the value false: