Page 1 of 1

On screen labels

Posted: Thu Oct 25, 2012 9:09 am
by jonathan.cronin
Hi,

I am having a little trouble with the text property of a label.

On start-up if I set an on screen label named "Label1" with text using the following script the label displays the text correctly:

Code: Select all

Label1.Text="myString";
If I then move to another screen and them move back to the original screen the text has been lost. Why is this?

Re-setting the text programmatically doesn't seem to fix it. If I break into the code at run-time using Visual Studio the text property shows the correct text but it is not displayed on screen.

This has been observed on an iX T60 panel and also whilst running in debug mode on a XP PC.

Any help or insight would be greatly appreciated,

Thanks,
Jonathan

Re: On screen labels

Posted: Thu Oct 25, 2012 9:18 am
by mark.monroe
Whenever you do a Show Screen, you create a new screen. That new screen instance will not have that set. Unless you rerun the code again. If you use Close screen, you can close the screen that is on top of your old screen.

Re: On screen labels

Posted: Fri Oct 26, 2012 2:34 am
by jonathan.cronin
Hi Mark,

Thank you for your quick reply. We tried closing a form using this.close() and screenname.close(). This closed the instance but immediately proceeded to instantiate a new instance of the form underneath rather than just showing it.

We need a method to control the Z-order of forms at run-time. We have found the ScreenManager class but have not figured out how to obtain a run-time reference. Can you advise?

Just out of interest, when calling .show() or .close() and a new screen instance is created is the old disposed? We have observed in debugging our old instance does seem to persist? Will this cause memory leak issues?

Thanks in advance,
Jonathan

Re: On screen labels

Posted: Fri Oct 26, 2012 9:45 am
by mark.monroe
I do not know of a way to get a hold of screen instances. Those are management by the underlying framework. The screens will be garbage collected by the system after a while.

The best thing to do is to create a Script Module and put the values that you need to keep track of in there. Then on screen open repopulate the screen with those values. Screens should never be used to keep track of persistent values because of the very thing you are running into.

Re: On screen labels

Posted: Wed Oct 31, 2012 6:37 am
by jonathan.cronin
Thanks for your help Mark, I will re-structure the project to remove anything I need to keep hold of from the screens.