Changing the style has no effect

Description:

After changing the Style, objects do not appear in the new style.

 

Solution:

According to the selected style EmWi decides during the creation of a new object, what variant should be created. So if you change the style in the Chora code, it has no effect on existing UI objects. To get the new style active, you need to destroy the existing objects and create them again.

 

If you don’t see a style as expected, check the following possible sources of the problem:

 

A) Is the correct style selected in EmWi?

B) Is the variant condition of your variant class correct?

C) Does the variant exist for the class?

D) Are visible objects recreated after a style change?

 

To recreate existing UI objects, EmWi offers a property ‘Style’ in the class Core::Root (base class of your application class) for that purpose. It can be changed e.g. from within a slot method of a styles menu.


GetRoot().Styles = ( styles + [ AquaStyle ]) - [ Win95Style ];

The class Core::Root automatically broadcasts a style event to all existing objects. This event can be processed in the HandleEvent() method of all objects that need to recreated.


var Core::StylesEvent
styleEvent = (Core::StylesEvent)aEvent;
if ((styleEv!= null )
&& (styleEvent.NewStyles ^ styleEvent.OldStyles ))
{
// Create and open a new instance of your own class
// Close this instance
  return null;
}
return super( aEvent );

 

See also:

1. You can see this mechanism in the Widgets example in the EmWi folder "Embedded Wizard\Example\Widgets\". Have a look in the methods Example::SkinMenu.AquaSlot() and Example::TopMenu.HandleEvent().

 

Keywords:

Styles, Variants, dynamic objects, StylesEvent

 

 

Last update on 2010-08-19 by Steffen Herrmann.

Go back