344 views
in GUI Development by
Hello,

when changing the language the combobox' selected item is not updated. Even if i click the combobox, the selected item is not updated. The appearing list has the correct language. All other text views are updated immediatly.

This behavior is already exists in the template class.

Multiligual is activated.

Best Regards Jonas

1 Answer

+1 vote
by
 
Best answer

Hello Jonas,

the ComboBox template depends on an OnLoadItem slot method to obtain the item contents. Accordingly, when you want the ComboBox to refresh its contents when the language changes, it is necessary to invalidate all items within the ComboBox explicitly so the ComboBox reloads them again. For this purpose you invoke the ComboBox's method InvalidateItems(...) providing in the parameter of the method the range of items to invalidate, e.g.:

ComboBox.InvalidateItems( 0, ComboBox.NoOfItems );

You can place the above invocation within a ReInit method of the GUI component embedding the ComboBox instance. Or, if all ComboBoxes in your application will display multi-lingual contents and all of them should be able to automatically reload their contents when the language is changed: implement the ReInit method directly within the ComboBox class. Then following would be the code of the method:

I just verified the above approach. The MultiLingual attribute on the ComboBox class, or other classes belonging to the ComboBox template will not have any effect in this case. I wonder thus how your implementation worked.

I hope it helps you further.

Best regards

Paul Banach

by

Thank you Paul. With invalidating the items on ReInit method the text shows the new language string.

I read the localization page in the EW Wiki:

With an alternative approach it is even sufficient to configure the attribute MultiLingual of the class implementing the GUI component. In this case Embedded Wizard will automatically take care of the appropriate re-initialization operations when the language has been changed. You don't need anymore to implement the above described method ReInit.

Therefore I thought that the ReInit method is not necessary. Have I understood it correctly that it is necessary to use the ReInit method always when Strings are loaded via slot?

by
Hello Jonas,

this is true if there are multi-lingual expressions used within the affected class to initialize e.g. object properties. With the MultiLingual attribute set true, Embedded Wizard generates then additional code to re-evaluate those multi-lingual initializations. In case of the ComboBox the strings are provided from the outside of the box.

Best regards

Paul Banach

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

...