Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Text IDs feature
PostPosted: Wed Nov 05, 2014 7:11 am 

Joined: Tue Nov 13, 2012 12:25 pm
Posts: 17

Offline
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!


 Profile  
 
 Post subject: Re: Text IDs feature
PostPosted: Wed Jun 08, 2016 5:20 am 

Joined: Fri Jan 15, 2016 2:39 am
Posts: 4

Offline
Did you ever figured out how to do this?
I need it too :)


 Profile  
 
 Post subject: Re: Text IDs feature
PostPosted: Wed Apr 04, 2018 5:21 am 

Joined: Fri Feb 24, 2017 7:06 am
Posts: 2

Offline
I have the same question...


 Profile  
 
 Post subject: Re: Text IDs feature
PostPosted: Mon Apr 09, 2018 8:36 am 

Joined: Mon Jun 11, 2012 2:10 pm
Posts: 119

Offline
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:
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:
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:
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.

_________________
Adam M.
Controls Engineer
FlexEnergy


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron