Using References for Vision Component Properties

In an effort to create standardized HMI screens, I'm working on creating a reference template. I'm aware of and currently in the process of implementing this through scripts tied to startup and window open events. However, I want to confirm whether or not there is a way to set component properties in Ignition to the value of component on a different window without scripting?

Example: setting all the fonts for labels to the font used on a label in a reference window.

Not across windows, no. Many things can be bound to Vision Client Tags, though.

Along these same lines, although I will be scripting:

How do you reference the property of a component in another window in the script for the current window?

For example, WindowA has a dropdown list and WindowB has a set of radio buttons.

In my visionWindowOpened script for WindowB, I want to look at the selected value of the dropdown in WindowA to determine the default radio button selection in WindowB.

I'm unclear on the proper syntax for this.

You can use system.gui.getWindow() to retrieve a reference to the actual other window object, and then walk its components as if it's local.
Be warned that this is often an antipattern - it's usually not advisable to tightly couple two windows together like this.

2 Likes

Was window B opened from window A? Are we talking about a parameterized window?

If you are simply wanting to set up default background colors, fonts, etc for consistency throughout the project, create tags, and store these parameters there. Then, you can simply bind your window properties to the tag properties.

I found that instruction and I'm working on that. I'm not trying to tightly couple properties of components. It's more of a one-shot deal to create an initial default when the window opens.

I am looking at the parameterization option as well since changing the selection in the dropdown will launch WindowB.

No tags are involved in this operation. But as I mentioned before, I am considering the use of parameters or even Custom Properties to manage this.

Sometimes I want the binding on a component in another window to refresh immediately, such as system.db.refresh(component, propertyName), in current window but cannot directly refer to that component, this function of system.gui.getwindow(windowPath) is a turnaround method. Good idea !!!