Resize Popup Window but not Content in Window

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?

You can set the layout of the components within the popup to anchored, top-left:
image

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.

It should by default

It does not.

hmm, you're right, it doesn't. Would it be viable to just set the minimum window size to a certain limit?
image

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

1 Like

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.

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.

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

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.

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

From the manual

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

How about from a visionWindowOpened script?

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

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:

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

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