On screen labels

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
jonathan.cronin
Posts: 4
Joined: Wed Sep 14, 2011 2:09 am

On screen labels

Post 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

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: On screen labels

Post 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.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

jonathan.cronin
Posts: 4
Joined: Wed Sep 14, 2011 2:09 am

Re: On screen labels

Post 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

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: On screen labels

Post 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.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

jonathan.cronin
Posts: 4
Joined: Wed Sep 14, 2011 2:09 am

Re: On screen labels

Post 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.

Post Reply