Adjust Human UI element size to UI window size

Hello.
I’m playing with Grasshopper and Human UI.
I have a bunch of elements (Expanders, 3D View) in my Human UI window, which I add and position via Create Grid.
Since the application will run side by side with other windows it would be nice to adjust the size of the window.
However, if I do that, the window changes, but the size of the elements in the window stays the same and I end up with stuff cut off or white space. See screenshot.

Is there a way to dynamically adjust the size of the elements with the window?
I am already using a static size variable with the Adjust Element Positioning Component to set the initial size, so I guess all I needed would be a way to feed the (current) size back to that. However, I seem to not be able to get window size. Any suggestions?

Thanks!

Rather than set an explicit size for your elements, you should use the Adjust Element Positioning component and right click the Horizontal Alignment input and select “Stretch”.

Cheers,
Marc

1 Like

Nice, that does it. Thanks for the quick reply, Mark!

1 Like

So Mark, I’ve been playing with your suggesting for a while. Works generally well, but I got stuck again at two points:

I am using a few value listeners upstream of the window generation and then update the window with the set functions from the UI output tab as recommended.
However, whenever the Value Listener updates, the elements on the Human UI window get moved out of their place.
Moreover, what is worse, a 3D Viewer to display my geometry is reset (seemingly to some internal value?), different from the settings I supplied through the Set 3D View Properties component (I have predefined views for the user to choose from the UI), and also different from the current view. How can I avoid that?

Second, and not so important: The Create 3D View component seems to require height and width data and hence doesn’t adjust to the window size. Any workaround that?

I guess these are three questions:

  1. how can I prevent Human UI elements to leave their desired positions when a upstream value listener updates?
  2. How can I make a 3D view keep its View Properties when a upstream value listener updates?
  3. How can I make a 3D View component adjust to variable window size (see previous question)?

I’ll be very grateful for any hints!

This is an indication that you have broken the cardinal rule of HumanUI – Use “Create” components only with static variables, and use “Set” with dynamic variables to update the created components. Look for places in your script where you are changing the values going into a Create HUI component, and remove those inputs and use a corresponding Set component instead.

Cheers,
Marc

you are right: there was a list that I created with dynamic data! Getting rid of that fixed (1) and (2). Only question (3) is still open. But I can live with that.
Thanks a lot!