How to manage the text change scripting trigger when the designer goes to preview mode


case 1:
I have a scritping , my purpose when the label text change then it will be triggered.
But when I test this code, if I click the designer into previous mode,
I don’t want it trigger but it actually trigger

case 2:
In this project, if I put this code in another input text’s event scripting, when I click the previous mode
I want it trigger but it actually don’t trigger
I use the same code under the condition.

if event.propertyName=='text':

how to scripting then I can make it work as my expect?

Seems a bit strange. Without being at my laptop I can’t test, but in your scripts maybe print out the event.propertyName so you can see what properties are changing. Make sure you identify in the print statement which component the change belongs to, eg

print "component 1:", event.propertyName

Then put it into preview mode and check the Console


I don’t understand that sentence. Can you explain more?

Tip: I think you should watch the RealPars video series What is a High-Performance HMI where they discuss use of colour, clutter, and the affect on the operator.

Preview mode

1 Like

I have try with TextFiled and Label, when I use your code, and make the designer into Preview mode, I found the reason in the Output Console, different component will trigger the different propertyName change while the designer come into Preview mode

Preview mode
thanks for your tips.

Whenever you enter preview mode, the designer sets the locale to whatever your preview locale is, which fires a translation event that triggers the text change.

The simplest solution would be to check if you’re in a designer in your propertyChange event:

1 Like