Page 1 of 1
Text IDs feature
Posted: Wed Nov 05, 2014 7:11 am
by ladin79
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!
Re: Text IDs feature
Posted: Wed Jun 08, 2016 5:20 am
by mmarks
Did you ever figured out how to do this?
I need it too
Re: Text IDs feature
Posted: Wed Apr 04, 2018 5:21 am
by gsavary
I have the same question...
Re: Text IDs feature
Posted: Mon Apr 09, 2018 8:36 am
by AMitchneck
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.
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);
}
Just in case you were interested, you can also get text from library groups:
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 "";
}
For example, to get text from Group1 you could then use the following function:
Code: Select all
public string GetTextFromGroup1(int value)
{
return GetTextFromLibrary(Globals.TextLibrary.Group1, value);
}
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.