505 views
in GUI Development by
What is a variant and how can I create a variant?

1 Answer

0 votes
by

Variants are a unique feature of Embedded Wizard. To explain it in a short sentence: A variant is an alternative implementation of a class, constant, font or bitmap resource. Its intention is to simplify the GUI customization to support within one Embedded Wizard project different skins and themes (look and feel), different screen resolutions (e.g. VGA, WVGA) or different feature sets (e.g. standard, premium).

With variants, you can customize a GUI, while the original implementation stays untouched. Together with the so called 'Styles' a variant can be activated or deactivated during runtime by assigning a style (or even a set of styles) to the global variable 'styles' in the Chora code. You can even decide during compile time to suppress the code generation for unused styles. This reduces the code size by simple setting the attribute 'Generate' of the style to 'false'.

If you don’t have yet defined your style, first of all you should drag and drop a new style brick from the templates Gallery folder 'Chora' into the project page in the Composer. Change the name to a self-explanatory name e.g. 'HdtvStyle' or 'BlueUiStyle'. This variant identifier will later be used as variant condition in your new variant.

Now let’s create a new Variant:

  1. Select the brick of a class, constant, font or bitmap resource with a single left button mouse click.
  2. Press the keyboard shortcut <Shift + Ctrl + Alt> and keep it pressed.
  3. Click on the selected brick with the left mouse button and hold it down.
  4. To create the variant, drag and drop the brick into the same or any other unit.
  5. The new variant brick is marked with a purple 'V'-sign. If not, something went wrong with the keyboard shortcut. Delete any accidently copied or derived brick and try it again.
  6. Don’t forget to set the correct variant-condition in your new variant. It can be set to either a 'Style' or a 'Profile' of your Embedded Wizard project.
  7. Finished. Now you can implement the alternative behavior or appearance in your variant.

For more details about variants, please have a look into the Chora User Manual chapter 'Variants'.

 

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...