# Passing Parameters to popup

**URL:** <https://forum.inductiveautomation.com/t/passing-parameters-to-popup/69854>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [February 14, 2023, 8:11pm UTC](https://forum.inductiveautomation.com/t/passing-parameters-to-popup/69854 "2023-02-14T20:11:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Randy\_Smart](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@Randy\_Smart](https://forum.inductiveautomation.com/u/Randy_Smart)\
**Post date:** [February 14, 2023, 8:11pm UTC](https://forum.inductiveautomation.com/t/passing-parameters-to-popup/69854/1 "2023-02-14T20:11:58Z")

</div>

Hello, I am trying to pass a couple custom properties from a main window to a popup window.

The two custom properties, both string values are:  
deck\_run\_fwd  
deck\_run\_rev

The two string values are just the following tag paths.

[default]MMI\_BinMotors/MMI\_BinMotors\_5\_3\_/Running\_Forward  
[default]MMI\_BinMotors/MMI\_BinMotors\_5\_3\_/Running\_Reverse

I am using the following tag change event client script:

root = system.gui.getParentWindow(event).getRootContainer()

propVal1 = root.deck\_run\_fwd  
propVal2 = root.deck\_run\_rev

As in the picture the statement: root = system.gui.getParentWindow(event).getRootContainer()  
on line 12 throws the following error.

TypeError: getParentWindow(): 1st arg can't be coerced to java.util.EventObject

The script was working but I must have changed something somewhere and it does not work  
now.  
Does anyone have any idea why the error occurs and how to fix it or find the source of the problem

 ![Ignition Script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/0/50e5cdbc8c8e04ee7a5bc0139f1166a45528e33c.jpeg)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 14, 2023, 10:52pm UTC](https://forum.inductiveautomation.com/t/passing-parameters-to-popup/69854/2 "2023-02-14T22:52:49Z")

</div>

> [@Randy\_Smart](#):
>
> TypeError: getParentWindow(): 1st arg can't be coerced to java.util.EventObject

The error is telling you what's wrong. In more detail: tag event scripts implicitly get a parameter that's _called_ `event`. However, this is **not** the 'EventObject' that is expected by [`system.gui.getParentWindow`](https://docs.inductiveautomation.com/display/DOC81/system.gui.getParentWindow). As the `system.gui` package implies, the event object you're expected to provide to `system.gui.getParentWindow` is a **GUI** event, such as a mouse click or key press.

> [@Randy\_Smart](#):
>
> The script was working but I must have changed something somewhere and it does not work  
> now.

The _only_ way that line of code would ever work was if you were invoking it _from a GUI event_, such as a button's `actionPerformed`. Moving it to a client event script means it will never work, _as written_.  
I _suspect_ that the proper place for this logic is going to continue to be a GUI event hook.  
Think of it the other way around - this code you've written is reacting to a tag changing. How would the client associate an event that is just "this tag has changed" with any particular window? _You_ must either A: invoke GUI logic _from a GUI event_ or B: make an _assumption_ in your script that "this tag has changed" means that, for instance, 'main window X' is open, and [grab it by name](https://docs.inductiveautomation.com/display/DOC81/system.gui.getWindow).

---

<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:** [February 15, 2023, 1:06pm UTC](https://forum.inductiveautomation.com/t/passing-parameters-to-popup/69854/3 "2023-02-15T13:06:02Z")

</div>

> [@Randy\_Smart](#):
>
> from a main window to a popup window.

Are you trying to do this when you open the popup? If so, just place the values you want for the popup's root container into the parameters dictionary of the `system.nav.openWindow()` call, using keys with the same names as the popup's root container properties.
