Add a way to get the true order of elements in a UIGridStyleLayout (UIListLayout and UIGridLayot)

As a Roblox Developer there is currently no way to get the order of frames in a UIGridStyleLayout (aka UIListLayout and GridLayout). Adding a method that returns an array of these objects in order in which they are disabled would be helpful for some UI related tasks (ie: custom controller selection order [especially useful since automatic behavior can be very finnicky], or automatically selecting a limited amount of items in a grid from top to bottom).

You can currently achieve a similar result by looping through the children of the UIGridStyleLayout’s parent and using table.sort to order them by layout order, however this only works if every frame has a sequential layout order. If multiple frames share the same layout order then its possible for elements to be skipped in favour of ones further down the line.

This is a probably pretty niche request but it would be nice to have. Surely the information for the true layout is stored somewhere backend already?

3 Likes

Why not use LayoutOrder property of GuiInstances?

1 Like

I don’t think you understand my post. LayoutOrder is just used to prioritise the position of one frame other another but if multiple frames have the same layout order then there is no way to get the actual displayed order of frames on the screen.

Honestly if you use them properly you shouldn’t have such issues…

I am using them properly? For example if you want to sort a players inventory by rarity then the way to do that without calculating the sort order of potentially hundreds of items everytime something is added ore removed is to set the sort order to match the rarity tier of item. Any case where you want to group items but you don’t care about order within the group is still proper use of LayoutOrder.

I personally would also sort them. Not just leaving “common”->“rare” as 1, 2 only, but if there’s 15 commons and 7 rares, I would assign individually 22 order numbers.
You may think that it’s “ok”, but I don’t think so, at least due to you having such problems and no real way to handle all items persistantly.

But I just don’t care about the order, Roblox clearly is storing the current order of frames in which they are displayed because order is maintained when inserting and removing elements. All I’m asking for is the ability to read this order so I don’t have to go through the effort of constantly calculating every frames layout order everytime I want to update the UI.

1 Like

This would also be good for alphabetical sorts, as we don’t really have a way to figure out the order other than manually sorting it.

please roblox please