# Manually Resize Popup on internalFrameActivated

**URL:** <https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651>\
**Category:** Ignition\
**Tags:** vision, scripting\
**Created:** [December 1, 2021, 11:01pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651 "2021-12-01T23:01:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [December 1, 2021, 11:01pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651/1 "2021-12-01T23:01:44Z")

</div>

I am having this problem where my popups are sporadic in their resizing on the `internalFrameActivated` event Handler. I am using client tags to store the values that they will resize to. It works great most of the time but if the tag read takes a little bit longer than the allotted time then it doesn’t work initially. If the popup or client refreshes after that it works good again.  
I couldn’t figure out how to put it into a function and run invokeLater on it as the size objects weren’t passing through it but is there a way I could nest that into an invokeLater, or something similar, and still have the code run in the correct order?  
code:

```auto
import time
from java.awt import Dimension

time.sleep(0.5)
H = system.gui.getParentWindow(event).getComponentForPath('RootContainer').TemplateHeight
W = system.gui.getParentWindow(event).getComponentForPath('RootContainer').TemplateWidth

value = Dimension(width=W,height=H)
system.gui.getParentWindow(event).getComponentForPath('_parent').size = value

```

---

<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 1, 2021, 11:08pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651/2 "2021-12-01T23:08:46Z")

</div>

Some notes:

- `event.source` is the window. No need to call .getParentWindow().

- Just read the client tags in your script to construct the `Dimension`.

- You have used a sleep in the UI thread. That blocks the entire UI–it does not allow anything else in the UI to finish. It’s just frozen. Whatever you think might happen almost certainly won’t. Don’t do it.

---

<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 1, 2021, 11:16pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651/3 "2021-12-01T23:16:02Z")

</div>

Also, consider not doing this in the window. The caller of `system.nav.openWindow()` is given the window object in return. The caller can then set `.size` on it.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 1, 2021, 11:48pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651/4 "2021-12-01T23:48:13Z")

</div>

This is the way

---

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [December 1, 2021, 11:54pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651/5 "2021-12-01T23:54:20Z")

</div>

1. That was an oversight of mine, I just used the property finder and that's what it returned. Thanks

2. Got it.

3. I was using sleep to give the tag bindings a chance to initialize as I got some weird errors when I first tried where the `internalFrameActivated` would run before the bindings initialized. It didn't work like you said

> [@pturmel](#):
>
> Whatever you think might happen almost certainly won’t.

Edit: grammar

---

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [December 1, 2021, 11:56pm UTC](https://forum.inductiveautomation.com/t/manually-resize-popup-on-internalframeactivated/53651/6 "2021-12-01T23:56:46Z")

</div>

I didn’t know you could set the size on `system.nav.openWindow`, it seems like I was way overcomplicating this. Thank you.
