Hi,
I am using the new version of iX (iX 2.1).
I noticed that there is an interesting new feature "Text IDs" on multiple languages section, my question is:
it is possible to assign texts through script?
Example:
TextBox1.Text = Globals.Multiplelanguages.TextID(7);
or something like that?
Thanks!
Text IDs feature
Re: Text IDs feature
Did you ever figured out how to do this?
I need it too
I need it too
Re: Text IDs feature
I have the same question...
-
- Posts: 137
- Joined: Mon Jun 11, 2012 2:10 pm
Re: Text IDs feature
There is a way to set an object's text to a text ID via script. To do this you need 3 things: the ID of the text you want, its default value, and the following code.
Just in case you were interested, you can also get text from library groups:
For example, to get text from Group1 you could then use the following function:
Just to note, if you change the display's language you will need to call the above function again to update the text to the new language.
Code: Select all
public string GetTextID(uint textId, string defaultValue)
{
Neo.ApplicationFramework.Tools.MultiLanguage.MultiLanguageResourceManager resources = new Neo.ApplicationFramework.Tools.MultiLanguage.MultiLanguageResourceManager(typeof(Neo.ApplicationFramework.Controls.Controls.Form));
return resources.GetText(textId, defaultValue);
}
Code: Select all
public string GetTextFromLibrary(Neo.ApplicationFramework.Tools.MessageLibrary.MessageGroup libraryGroup, int value)
{
for (int i = 0; i < libraryGroup.Messages.Count; i++)
{
if ((libraryGroup.Messages[i].StartValue <= value) && (libraryGroup.Messages[i].EndValue >= value))
{
return libraryGroup.Messages[i].Message;
}
}
return "";
}
Code: Select all
public string GetTextFromGroup1(int value)
{
return GetTextFromLibrary(Globals.TextLibrary.Group1, value);
}
Adam M.
Controls Engineer
FlexEnergy
Controls Engineer
FlexEnergy