# Open popup at bottom right corner of the window

**URL:** <https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 23, 2023, 8:15am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477 "2023-03-23T08:15:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 23, 2023, 8:15am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/1 "2023-03-23T08:15:45Z")

</div>

Hi,

I like to open the **popup at bottom right corner of the window**

how to do that

i have tired like this

```auto
window = system.nav.openWindow('Common/Feedback')
system.nav.bottomRightWindow(window)

```

but its throwing error

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 23, 2023, 10:18am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/2 "2023-03-23T10:18:10Z")

</div>

> [@prasath.t](#):
>
> `system.nav.bottomRightWindow`

The user manual system.nav page doesn't list a function `bottomRightWindow`. Did you just make it up in hope or am I missing something?

[https://docs.inductiveautomation.com/display/DOC80/system.nav](https://docs.inductiveautomation.com/display/DOC80/system.nav)

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 23, 2023, 10:31am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/3 "2023-03-23T10:31:55Z")

</div>

Yes its not mentioned

I just tired

Is there any way to do that?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 23, 2023, 11:34am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/4 "2023-03-23T11:34:24Z")

</div>

```python
window = system.nav.openWindow('Common/Feedback')
window.setLocation(200, 50)

```

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 23, 2023, 11:44am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/5 "2023-03-23T11:44:40Z")

</div>

Set Location depends upon the screen resolution right?

I tired it showing in **Left top corner**

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 23, 2023, 11:47am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/6 "2023-03-23T11:47:52Z")

</div>

> [@How to get vision client resolution](https://forum.inductiveautomation.com/t/how-to-get-vision-client-resolution/27328):
>
> Hello Is there any way to get vision client session resolution?

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 23, 2023, 11:52am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/7 "2023-03-23T11:52:19Z")

</div>

From your script got the resolution

resolution: 1920 x 1080  
dpi: 96  
scaleX: 1.0  
scaleY: 1.0

how to identify the left bottom corner position?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 23, 2023, 1:29pm UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/8 "2023-03-23T13:29:48Z")

</div>

> [@prasath.t](#):
>
> resolution: 1920 x 1080

This assumes that your window is full screen, which I do not feel is correct. You need to get your parent window size. To position a popup on the left side of the parent window, your x coordinate is going to be 0. To position a popup at the bottom of the parent window, your y coordinate will be the height of the parent window minus the height of the popup window.

The code will need to look something like this:

```auto
parentWindow = system.gui.getParentWindow(event)
popup = system.nav.openWindow('Popup')
x = 0
y = parentWindow.height - popup.height
popup.setLocation(x, y)

```

**Edit:** I should note that height is an absolute property that is measured in pixels. Therefore, there shouldn't be any need to consider screen resolution; it will already be accounted for.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 24, 2023, 8:54am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/9 "2023-03-24T08:54:02Z")

</div>

@justinedwards.jle  
Is there any way to run this script in vision client timer?

when used in vision client timer - throwing error **parentWindow = system.gui.getParentWindow(event)**

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 24, 2023, 10:42am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/10 "2023-03-24T10:42:23Z")

</div>

It should work just fine from a timer. What event handler was used? How was the script qualified? What was the error?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 24, 2023, 10:48am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/11 "2023-03-24T10:48:56Z")

</div>

Probably no event. This would work best in the internalFrameActivated event of the popup, IMO.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 24, 2023, 10:55am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/12 "2023-03-24T10:55:28Z")

</div>

> [@prasath.t](#):
>
> event

Yes jordan is correct... there is no event error

i found a alternative

system.gui.getOpenedWindows()

using this i can get the open window

but one issue is it's fetching all the windows(popup too) - i need to filter that's the trick

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 24, 2023, 11:09am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/13 "2023-03-24T11:09:11Z")

</div>

You could do something like:

```auto
for window in system.gui.getOpenedWindows():
     if window.name == 'yourWindowName':
          parentWindow = window
          break

```

...but if you are doing it from the internalFrameOpened event handler of the popup, it doesn't seem appropriate to assume that the popup ~~was launched from~~ _is nested in_ a specific window. If I remember correctly, you can use swing utilities to get the window the popup ~~was launched from~~ _is nested in_. The script would look like this:

```auto
from javax.swing import JFrame, SwingUtilities
popup = event.source
parentWindow = SwingUtilities.getAncestorOfClass(JFrame, popup)
x = 0
y = parentWindow.height - popup.height
popup.setLocation(x, y)
```

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [March 24, 2023, 11:15am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/14 "2023-03-24T11:15:49Z")

</div>

no i am writing the script in vision client timer

---

<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:** [March 24, 2023, 11:52am UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/15 "2023-03-24T11:52:11Z")

</div>

> [@justinedwards.jle](#):
>
> If I remember correctly, you can use swing utilities to get the window the popup was launched from.

No, `SwingUtilities` has no insight into the **call chain**. It follows the component hierarchy. Windows belong to a desktop.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [March 24, 2023, 12:40pm UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/16 "2023-03-24T12:40:59Z")

</div>

> [@pturmel](#):
>
> No

I could have swore I had used this approach in other scenarios with success. To confirm, I set up a test, and the script worked as expected with the popup appearing in the lower left of the parent window:

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

...so I assume the issue with my statement is semantical. I should have said the window the popup is _ **nested in** _ instead of _ **launched from** _? ...or is there some other concept I need to learn to frame this correctly?

---

<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:** [March 24, 2023, 12:42pm UTC](https://forum.inductiveautomation.com/t/open-popup-at-bottom-right-corner-of-the-window/71477/17 "2023-03-24T12:42:47Z")

</div>

> [@justinedwards.jle](#):
>
> I should have said the window the popup is _ **nested in** _ instead of _ **launched from** _?

Yes, a popup can be launched into a different desktop by a script. You won't have any information about the caller, just **where** the desktop opened.
