# Resize Popup Window but not Content in Window

**URL:** <https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [May 31, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387 "2023-05-31T19:08:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/1 "2023-05-31T19:08:25Z")

</div>

Is there a way to allow a popup window to be resized, but not resize the content in the window and force an overflow instead?

---

<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:** [May 31, 2023, 7:29pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/2 "2023-05-31T19:29:03Z")

</div>

You can set the layout of the components within the popup to anchored, top-left:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/ca19d8cb4a9f7c6b006cf3f66c0c416e7ec24745.png)

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 7:34pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/3 "2023-05-31T19:34:00Z")

</div>

Is there a way to get scroll bars to show up as the window shrinks to smaller than the content?

Also, it seems like the resized window size is stored in memory and it returns to the "new size" when opened again.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 31, 2023, 7:35pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/4 "2023-05-31T19:35:22Z")

</div>

It should by default

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 7:36pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/5 "2023-05-31T19:36:56Z")

</div>

It does not.

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/12a7bf11409ba295ffb5dd748ffa50fcc74b75fd.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 31, 2023, 7:49pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/6 "2023-05-31T19:49:48Z")

</div>

hmm, you're right, it doesn't. Would it be viable to just set the minimum window size to a certain limit?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/745c0874e8ef2f7647e606e70783a4a5c79ee29c.png)

---

<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:** [May 31, 2023, 7:50pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/7 "2023-05-31T19:50:35Z")

</div>

For a popup, you will probably want to embed your components in a template, and then use a template canvas within the popup to display the template with the components. The template canvas will provide both the scroll pane and the layout constraints.

[https://docs.inductiveautomation.com/display/DOC81/Using+the+Template+Canvas](https://docs.inductiveautomation.com/display/DOC81/Using+the+Template+Canvas)

---

<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:** [May 31, 2023, 7:52pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/8 "2023-05-31T19:52:39Z")

</div>

> [@amarks](#):
>
> Is there a way to get scroll bars to show up as the window shrinks to smaller than the content?

No. Vision only shows scroll bars for certain components, or for the outer JFrame of a desktop (when a floating window would go outside its bounds), never for your application windows themselves.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 8:09pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/9 "2023-05-31T20:09:14Z")

</div>

The minimum window size is still quite large, so once you have 2 open you can't really open more. So, I was thinking I could allow the user to change the width and scroll left/right as needed, since information is displayed in something approximating columns.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 8:09pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/10 "2023-05-31T20:09:42Z")

</div>

> [@justinedwards.jle](#):
>
> For a popup, you will probably want to embed your components in a template, and then use a template canvas within the popup to display the template with the components. The template canvas will provide both the scroll pane and the layout constraints.
> 
> [Using the Template Canvas - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Using+the+Template+Canvas)

This would be the solution I'm looking for. Everything is already templatized, so easy enough to implement.

Thanks!

Edit: scaling does need to stay scaled, not anchored with the template canvas

It doesn't seem to want to work with my parameters though...  
The cell update binding on the parameters column updates the value, but it doesn't seem to propagate through to the template.

These two templates are bound to the same template with the same parameters, but as you can see the original template is correct, but the one in the canvas is not.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/d/2d41fd77e087b81cfdbe2815aca88f587eb679aa.png)

I can see the updated parameter in the dataset editor for the template dataset.

The layout of my parameters was wrong. It needs a dictionary of keys and values.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 8:24pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/11 "2023-05-31T20:24:31Z")

</div>

Now, how to revert the window to the default size when initially opened?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 31, 2023, 8:26pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/12 "2023-05-31T20:26:32Z")

</div>

From the manual

```auto
# Opens a popup window, and sets the dimensions to 100 pixels x 100 pixels.
window = system.nav.openWindow("popup")
window.size = (100,100)

```

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 31, 2023, 9:33pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/13 "2023-05-31T21:33:33Z")

</div>

How about from a visionWindowOpened script?

```auto
window = system.gui.getParentWindow(event)
window.size = system.gui.getParentWindow(event).getComponentForPath('_parent').size

```

That should work, no?

---

<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:** [May 31, 2023, 11:18pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/14 "2023-05-31T23:18:09Z")

</div>

> [@amarks](#):
>
> That should work, no?

That wouldn't get the original size of the window.

`system.gui.getParentWindow(event)` and `event.source` are equivalent statements from the context of a visionWindowScript; although I do find the former in a lot of my own scripting since that's what the Vision component icon returns in the script editor. In any case, the field you are looking for is preferredSize, so the script you want for a visionWindowOpened event handler is simply:

```auto
event.source.size = event.source.preferredSize

```

**Edit:** I threw this setup into my test environment, and it didn't work as I expected. The window **did** open to the same size each time, but it didn't match the dimensions that were saved in the designer. Perhaps the easiest way to ensure that the window opens to the original size each time doesn't involve scripting at all.

Instead, this effect can be ensured by simply setting the popup window's cache policy to "Never":  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fa06ca16a2ea374507b99cb8a11a9aa159a37265.png)

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 1, 2023, 12:59pm UTC](https://forum.inductiveautomation.com/t/resize-popup-window-but-not-content-in-window/74387/15 "2023-06-01T12:59:58Z")

</div>

While that would work, that could have a negative impact on performance and the experience of the UI.
