I want to align the buttons in a UIGridLayout to be centered, but when there’s more than 1 row it doesn’t center anymore
Center treats the entire horizontal view as being centered. As you add more elements the total width of elements laid out increases, so it has to use the largest horizontal size in centering.
I think you want the 4th element in the first screenshot to go to the center, could you explain the use case here?
For this UI, I would like the second row to still be centered
why is centered in this particular UI useful? I don’t doubt it, just trying to understand the entire use case
For aesthetics, I think it would look better to have even spacing on either side of the 4th element instead of it being aligned to the left
You can achieve this pretty easily by using a combo of UIListLayouts. I’ve attached an example of how to do this.centergridex.rbxl (21.8 KB)
If this were to be changed, it would need to be a new property instead. Fixing this would be good in some cases, but would break some of my UIs.
For example:
If the current behavior were to be changed, the 3rd row would be centered, which I don’t want. But, adding a new property to UIGridLayout that does this would be good, so that it doesn’t change any existing UIs.
I’d prefer second row be centered like the first row so that the menu id displayed in a consistent way as items are added or removed. Using a list of grid layouts, or list of lists sounds like a hacky solution that I would rather not resort to.
A link to my recent bug report that I made without knowledge of this report:
Hacky solution, it works. But I think it should be possible with the UIList or UIGrid alone. It will be a lot more user friendly that way. Let’s say you don’t know how many rows there will be? That is why the default game engine functionality would be nice to have added.
(Sorry for bumping this old thread, but this topic is still relevant.)
bump
i need this for my current ui (had to use hacky way, pls just add a option)