# Linking Components

**URL:** <https://forum.inductiveautomation.com/t/linking-components/11054>\
**Category:** Ignition\
**Created:** [January 15, 2016, 6:52pm UTC](https://forum.inductiveautomation.com/t/linking-components/11054 "2016-01-15T18:52:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WaleedK](https://avatars.discourse-cdn.com/v4/letter/w/77aa72/32.png) [@WaleedK](https://forum.inductiveautomation.com/u/WaleedK)\
**Post date:** [January 15, 2016, 6:52pm UTC](https://forum.inductiveautomation.com/t/linking-components/11054/1 "2016-01-15T18:52:54Z")

</div>

Hi, I am not exactly sure on how to do this or even if you can. How would i go about linking a component on one root container of a window to a component on a different root container of a window. By linking i mean using it in the script or even binding a property to the component on one root container to another component on another root container. For instance, i have a label on a docked window which needs to change its text every time a button on a second docked window is used. Or is there a way to have two docked windows on one root container?

Thank You.

---

<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:** [January 15, 2016, 7:07pm UTC](https://forum.inductiveautomation.com/t/linking-components/11054/2 "2016-01-15T19:07:04Z")

</div>

You must use scripting, as the standard bindings only work within one window. Windows are peers and the platform cannot guarantee that one window is open for another to bind to.  
The simplest approach is to use a propertyChange event on one window to look up the 2nd window and write the new value to the appropriate place. With error handling as needed for failure to get the 2nd window. In the second window, use a window event to load the value from the first window when activated.

---

<div class="post-metadata">

**Author:** ![WaleedK](https://avatars.discourse-cdn.com/v4/letter/w/77aa72/32.png) [@WaleedK](https://forum.inductiveautomation.com/u/WaleedK)\
**Post date:** [January 15, 2016, 7:43pm UTC](https://forum.inductiveautomation.com/t/linking-components/11054/3 "2016-01-15T19:43:42Z")

</div>

Thank you for the fast reply. My next question is then how do i use the property change event handler to look up the second window? Do i have to write the path in the script of the other window as well? or am i able to use the insert a property option and look for the path to the component on the second window?

---

<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:** [January 15, 2016, 11:05pm UTC](https://forum.inductiveautomation.com/t/linking-components/11054/4 "2016-01-15T23:05:04Z")

</div>

The propertyChange event script would look something like this:`if event.propertyName=='sourceProperty':
  w = system.gui.getWindow('otherWindowName')
  if w:
    c = w.rootContainer.getComponent('otherComponentName')
    c.otherProperty = event.newValue`The script editor will only offer things in the current window, so you have to type the strings in yourself.
