# Open Popup on another popup at cursor location

**URL:** <https://forum.inductiveautomation.com/t/open-popup-on-another-popup-at-cursor-location/7153>\
**Category:** Ignition\
**Created:** [August 28, 2013, 4:25am UTC](https://forum.inductiveautomation.com/t/open-popup-on-another-popup-at-cursor-location/7153 "2013-08-28T04:25:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [August 28, 2013, 4:25am UTC](https://forum.inductiveautomation.com/t/open-popup-on-another-popup-at-cursor-location/7153/1 "2013-08-28T04:25:55Z")

</div>

I would like to open a popup on an existing popup at the cursors position on an event (mouse release).

using event.x and event.y gives you the cursor position of the events source component (button), so a button that is 30 x 10 clicked in the middle gives you 15 and 5…

Setting the location of the new popup using those coordinates then shows the window based on the projects full window, so you get the popup in the top left corner.

I was hoping that the event location would be based on the entire screen but seems no to be.

Any ideas?

cheers

Tim…

---

<div class="post-metadata">

**Author:** ![Ron.Lor](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@Ron.Lor](https://forum.inductiveautomation.com/u/Ron.Lor)\
**Post date:** [August 31, 2013, 12:10am UTC](https://forum.inductiveautomation.com/t/open-popup-on-another-popup-at-cursor-location/7153/2 "2013-08-31T00:10:22Z")

</div>

So in order to accomplish this, you will need to know the x and y location of the button in the window and the x and y location of the window in the client. You will need to use getX() and getY() on both the component and the window. The script will look something like this:

[code]mouseX = event.x  
mouseY = event.y  
compX = event.source.getX()  
compY = event.source.getY()  
parWindow = system.gui.getParentWindow(event)  
windowX = parWindow.getX()  
windowY = parWindow.getY()

window = system.nav.openWindow(“Popups/Popup”)

window.setLocation(mouseX+compX+windowX,mouseY+compY+windowY)[/code]

---

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [August 31, 2013, 12:13am UTC](https://forum.inductiveautomation.com/t/open-popup-on-another-popup-at-cursor-location/7153/3 "2013-08-31T00:13:09Z")

</div>

Legend. ![:prayer:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e5a7e3b63facc151ea73e3b45db7bdb3d4bdc316.gif ":prayer:")

Will give it a go

Cheers

---

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [September 2, 2013, 12:57am UTC](https://forum.inductiveautomation.com/t/open-popup-on-another-popup-at-cursor-location/7153/4 "2013-09-02T00:57:28Z")

</div>

Worked like a dream.

Thanks again.
