Updating Text Field

Hello all,

I have what is probably a pretty simple problem that I have been unable to find a solution to.

Basically, I have two text fields in my Vision window - Text Field 1 and Text Field 2. Text Field 1 has a binding to a PLC tag which is giving it the information that I am reading from a barcode.

I want to write some script that will parse out the text that I need from Text Field 1, which I have no problem doing. What I am struggling with, however, is getting the script to fire in Text Field 2 every time the Text Field 1 changes.

All help is greatly appreciated.

Thank you!

Why would the script fire in Text Field 2? What role is Text Field 2 playing in this? The property change event will run the script, perhaps you mean you want the result to be written to Text Field 2?

Can the values be edited? If not, I would expect you to use a Label component.

Text Field 2 is parsing my raw string data since that is how I am bringing it in from the PLC. I want to pick a piece of the raw string out every time the raw string changes in Text Field 1.

I can, and probably should, us a label for this as the value will not be edited. Either way, I still have the same challenge.

I just don't understand the need for two components here.

You should have a custom property on the component which holds the raw value from the PLC.

Then, I would use an expression binding on text property to do the parsing (obviously I don't know what kind of parsing is being done so this is a simplistic approach). The different string expressions generally can be combined to do the parsing.

The same thing, can of course be accomplished by simply using the property change event and setting the text property to the parsed value, you should filter the property change for the appropriate property, and be aware that the change can and will fire twice in some instances.

Yea. That's why I have two components. The raw text string isn't the prettiest thing to work on, so the expression binding wasn't cutting it. I needed a full-blown script. I can definitely do this in one component, but I like to break things up when in development - it helps me understand what is going on better.

Any-hoo, turns out I was adding my script to Text Field 2 instead of Text Field 1 on the property change event, which obviously wasn't going to work. All I need is to place my script in the Text Field 1 components and it does what I needed it to do.

I just didn't have a good enough understanding of the property change event handler. Adding print event.propertName really helped me understand what was going on.

Thanks so much for taking the time to respond. Your questions really forced me to look deeper at what was going on and got me to the solution.