231 views
in GUI Development by

Hello,

I have made all my classes with Multi-Lingual true.
Classes which i generate dynamically with the "new" keyword are not changing language.
How do i achieve this?

Example:
this.Owner.SwitchToDialog( new Application::MyDialog, null, null, null, null, null, null, null, null, null, false );

Thank you in advance!

1 Answer

0 votes
by
 
Best answer
Hello Bjs,

I have tried to reproduce your application case but without success. In my application the dialogs were updated correctly when the language is changed. Can you reduce your application to a simple example demonstrating the issue?

Best regards

Paul Banach
by

Hello,

I have build an "Database" array on startup with contains ~40 elements of my 'UI parameters' class. These UI parameters contain a UID, Name, Value and more. Then later on i use these to fill in a 'UI element' class (a value/toggle/text box for example).

Now i am trying the %+GetText() method to fix this but i am passing the strings as arguments back and forth from everywhere. I am uncertain this method will work when the string comes from this "Database".

https://doc.embedded-wizard.de/managing-localization?v=9.00

Edit:
I tried and it does not work, when i run the method "%+GetText()" to return Strings::MyString, it does change language.
When i call "%+GetText()" to return "Application::Global_UI.MyDatabaseArray[0].Name (contains Strings::MyString), language is not changing.

Is there a way to load the strings into the "Database" array without lose of multi-language? Similar to the "%+" to return, but instead to store.

Edit2:
Tried changing the database class .Name from from using a variable string to instead a property string, did not help also.

Edit3:
Now i have a working solution but i dont like it. I need now to create ~40 separate properties and set the 'default' to the different required strings. I lose my link with the UID because i tested it and i cannot build my 'Database' array with using of these properties also, only works when i directly call the property from the %+GetText() method. So i have to make an extra switch case statement to select the correct property, which the same as not going through all that effort mentioned above with creating properties but using a switch statement to find the correct String:: .. 

bjs

by

Hello Bjs,

without seeing your implementation it is difficult for us to deduce what is wrong or how your application works. Nevertheless I tried to reproduce your application case and it worked. Following are the steps I have implemented:

Step 1: New class DatabaseClass added.

Step 2: In the class DatabaseClass I have added a method GetText().

Step 3: The method GetText() returns a string matching the actual selected language.

Step 4: in my GUI component I have added a Text view.

Step 5: The Text view is configured with its String property to obtain the string from Database autoobject as shown below:

Step 6: The GUI component containing the Text view (and evaluating the multi-lingual expression) have been configured with its attribute MultiLingual = true.

With this implementation, the Text view updates its text automatically when the language is changed. I hope it helps you further. If not, you can simplify your application to a simple example and upload it here for test purpose.

Best regards

Paul Banach

by

Hello,

Is it possible to have in your example the "Database.GetText()" provide a function argument such as "Database.GetText(this.UID)", or have the "Database.GetText()" call another function which will return the string i require? i can only place the "%+" in the Prototyper window, but i need to place it in functions.

I have UI element classes such as the value/toggle/text which are initialized after the "new", maybe i need to change the "init" to accept parameters if that is possible? Because now i init all strings/values/UIDs with -1 or "" which i need to have with the "%+GetText()", but the element does know how what it is at that moment.

Changing the Init is not possible..

https://doc.embedded-wizard.de/init-method-member?v=9.30

Edit:
I have a working solution now by creating a method to call the get Text later on after i have done the initializations and giving the UID's Values, Strings, i think this is for me the only way of how i have build the program.

bjs

by

Hello bjs,

Is it possible to have in your example the "Database.GetText()" provide a function argument such as "Database.GetText(this.UID)"

Yes, this is possible. You should only ensure that UID (variable?) is already initialized with the right value before the expression Database.GetText( UID ) is evaluated. If a GUI component contains several variables/properties/objects, these members are initialized according to their Z-order. See also: Reorder members. The variable UID should have a lower order than the other members evaluating UID in their initialization expression. 

... maybe i need to change the "init" to accept parameters if that is possible?

If your intention is to add parameters to the Init-method, then this is not supported. You can however implement your own method (e.g. Setup( par1, par2, ..))  with all the desired parameters and invoke it immediately after new.

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

...