Can't get UISizeConstraint to fill up remaining horizontal space (incl. repro)

Here’s my GUI layout


Image 1, the results of my layout.

Everything is fine, except the red part is suppose to fill up all remaining space so that the yellow part ends up on the far right side like this:


Image 2, how I want the layout to be.

I’ve tried List, Grid and Table layout but none really do the job.
Inside each frame I got a UISizeContraint, which all have a defined MaxSize except Frame3 (red part)

It still just ends up as image 1.
What am I doing wrong?

Repro file here: GridIssue.rbxl (19.2 KB)

2 Likes

What’s the size of the actual frame? A size constraint ensures that the absolute size of the frame does not go above MaxSize or below MinSize. The frame itself can be anything in between.

All frames have Min-Max size same as their frame size.
Except frame3 who has size {1,0,0,35}

A UIGridLayout will take control of the frame’s size UNLESS a UISizeConstraint prohibits it. In this case the size constraint lets the frame be that size, so it is.

Removing UISizeConstraint from red frame (while using GridLayout) makes frame size 0,0. It doesnt stretch it.

That makes sense. If the CellSize of the grid layout is {0, 0, 0, 0}, then the size will set to that without the UISizeConstraint.

Cool but do you have a solution?

1 Like

I don’t see why you can’t just set the sizes of frames without any layouts or constraints. Is there a specific reason you are doing it this way?

The screensize is always different and also I want to adjust the size of the blue and purple frame at times without having to recalculate everything.

But seems like there’s no other option with these layouts.

Don’t UIs automatically size to fit the dimensions of a screen? By that, I mean if there was a size value like (0.3,0,0.5, 0) then that’d be half the screen on the Y axis and 3/10’s of the screen on X.

This isn’t possible to do with the current layout system, unfortunately. We’re planning to introduce a feature to handle this automatically sometime next year, but for now you’ll have to use a Lua script to calculate the remaining size in the parent and set the red frame’s size appropriately.

5 Likes

Alright, thanks for clarifying.

Has this issue ever been fixed? Because it’s been 4 years and i still can’t find the solution

Any updates on this? Would be a useful feature to have right now. : )

1 Like