# Message Handler Between Template and Parent Window

**URL:** <https://forum.inductiveautomation.com/t/message-handler-between-template-and-parent-window/83434>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [December 21, 2023, 5:13pm UTC](https://forum.inductiveautomation.com/t/message-handler-between-template-and-parent-window/83434 "2023-12-21T17:13:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [December 21, 2023, 5:13pm UTC](https://forum.inductiveautomation.com/t/message-handler-between-template-and-parent-window/83434/1 "2023-12-21T17:13:56Z")

</div>

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

```auto
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.

```auto
Title = {Root Container.equipPath}/Equip_Name

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/e/3e085d27fe42d72d6f7791aaeeffa3d76dcb8ba4.png)

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/e/3e026fb6dff9be986d7d5ea00833f9d73148ee00.png)  
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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 21, 2023, 5:46pm UTC](https://forum.inductiveautomation.com/t/message-handler-between-template-and-parent-window/83434/2 "2023-12-21T17:46:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [December 21, 2023, 5:48pm UTC](https://forum.inductiveautomation.com/t/message-handler-between-template-and-parent-window/83434/3 "2023-12-21T17:48:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [December 21, 2023, 5:57pm UTC](https://forum.inductiveautomation.com/t/message-handler-between-template-and-parent-window/83434/4 "2023-12-21T17:57:02Z")

</div>

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.

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

```
