Message Handler Between Template and Parent Window

I've got a popup window with a few custom properties/parameters.

equipmentGroup = Pump
equipment = Pump1
equipPath = [default]Pumps/Pump1

The equipPath is used to indirectly bind to a UDT's string member (Equip_Name) for display in the popup titlebar.

Title = {Root Container.equipPath}/Equip_Name

The other 2 parameters are used to determine the path to and the parameters for a sub-template that is shown in the popup. Within that sub-template is a "next equip" button that is able to change all of the indirection within the template to other equipment in the same group. (i.e. viewing Pump1, clicking it will change everything to Pump2)

The only thing that doesn't change is the popup window title because the rest of the indirect bindings are all internal to the template where that next equip button is.


My question is, how can I "populate up" that indirection change to the popup window so that the Title of the popup window reflects the new equipment name? (If I can even do that. If not, I'll probably just remove the buttons since they're a convenience feature.)

Would there be a way to use a property change script on the sub-template to send a message that then updates the equipPath value for the window? Not sure how to script it on the "receive" side. I've not done much message handling.

Vision doesn't do client-side internal messaging. It isn't necessary, as an event script in Vision can interrogate its component context (event.source) to find any desired object in the application. Templates can recursively follow .parent to obtain a reference to a containing template or window, and then go back inward with getComponent(name) to traverse it. In your case, you'd simply assign to the popup window's title property after you get its reference.

(People used to non-isolated nature of Vision are really annoyed by the very tight isolation of Perspective views.)

1 Like

So from the button I should be able to use .parent a couple more times (or maybe system.gui.getParentWindow()) from the button to get to the popup window's equipPath property directly?

1 Like

A property change script within the template is able to grab the parent window with system.gui.getParentWindow() and set the appropriate property from within the template.

if event.propertyName == 'pumpPath':
	system.gui.getParentWindow(event).getComponentForPath('Root Container').equipPath = event.source.pumpPath
2 Likes