Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Read text from one other screen
PostPosted: Mon Apr 07, 2014 12:30 am 

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

Offline
Hello,
I noticed that if I try to access a text belonging to another form I can’t return this text as long as the form does not appear at least once, I'll explain,
if from Screen1 I try to read a text in Screen2 using this code:

In Screen1:
AnalogNumeric.Text = Screen2.getTextPageTitle();

In Screen2:
public partial class Screen2
{
static string pagetitle;
void Screen2_Opened(System.Object sender, System.EventArgs e)
{
pagetitle = this.Title.Text;
}
static public string getTextPageTitle()
{
return pagetitle;
}
}

the text will be returned only after screen2 will be opened at least once, there is a way to have the text always available, or is there a way via script to read text directly from the Multiple languages table?
Thank you very much.


 Profile  
 
 Post subject: Re: Read text from one other screen
PostPosted: Tue Apr 22, 2014 4:38 pm 

Joined: Thu Jun 06, 2013 9:21 am
Posts: 61

Offline
Don't use private types because these screens get re-instantiated. Basically, the objects in memory gets cleared. Its unreliable. Use Globals context.

Globals.Tags.Tag1.Value = 5;

This will ensure that your data will survive. As a developer you would choose to develop this way. Unfortunately, the way IX was designed, its not advised to use this way.

Alternately, script modules are next safest way to store data. Encapsulation works better and these scripts modules do not get wiped out. If you have a class like TcpClient, tags cannot support this data type. Use a script module instead.

Best Regards,
Stuart


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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: