UIListLayout not updating because not listening to element property changes

All the behavior mentioned in this thread can be observed with this repro file: repro.rbxl (16.1 KB)

Pinging @Tiffblocks

Bug 1.

Step 1. Toggle the Visible property of the center element – the list layout does not update
Step 2. Cut and paste the center element back into the list, and note that it updates properly
Step 3. Toggle the visible property of the new center element – the list layout does not update
Step 4. Cut and paste the new center element back into the list, and note that it updates properly
Step 5. Toggle the visible property of the now and original center element, and note that it updates properly
Step 6. Cut out the UIListLayout. The elements lose their sorting
Step 7. Paste back in the UIListLayout. The elements are sorted again
Step 8. Toggle the visible property of the center element – it does not update the list layout

It looks like UIListLayout isn’t looking for property changes of elements unless they were added after the UIListLayout was. The Visible property is not the only one either, as the Size property experiences the same problem.

Bug 2.

Step 1. Cut and paste all elements back into the main frame so they’re being tracked by the UIListLayout
Step 2. Change the SortOrder from LayoutOrder to Name – nothing happens
Step 3. Cut and paste “Frame2”. It will be added to the bottom of the list, but “Title” remains at the top. There will always be a warning printed to the output:

UIListLayout sort function is unstable! Unable to find object Frame1 using binary search, had to resort to linear search

It looks like changing the SortOrder discards any knowledge and/or property listeners the UIListLayout had, and it does not rebuild them and update the sort with the new order.

4 Likes

Most of these bugs should be fixed by a change I have waiting to ship. The remaining ones I’ll look into.

2 Likes

This should be fixed now.

3 Likes

Are you sure this has been fixed? I’m experiencing problems with my plugin: https://www.roblox.com/library/1378546707/test

I rename a few objects on a line at the same time and the ordering doesn’t seem to be updating correctly. My script does not create the UIListLayout, it is already existent inside a GUI.

LineAPI = {}

--//InsertLetter
function LineAPI:InsertLetter(LineNumber, Position, Letter, OwnInput) --Places letter after specified letter position | OwnInput decides whether the focuspoint should focus to new new letter
	local Line = EditorUI.Content[LineNumber]
	
	local LetterLabel = Instance.new("ImageLabel") 
	LetterLabel.ZIndex = 55
	LetterLabel.BackgroundTransparency = 1
	LetterLabel.ImageColor3 = settings().Studio["Text Color"]
	LetterLabel.Name = Position+1
	
	if FontData[Letter] ~= nil then
		LetterLabel.Image = FontData[Letter].Image
		LetterLabel.Size = UDim2.new(0, FontData[Letter].Width, 0,16)
	else
		LetterLabel.Image = FontData.Unknown.Image
		LetterLabel.Size = UDim2.new(0, FontData.Unknown.Width, 0,16)
	end
	
	local Letters = {}
	for _, FLetter in pairs(Line.Text:GetChildren()) do
		if FLetter.ClassName == "ImageLabel" then
			if tonumber(FLetter.Name) >= LineNumber then
				table.insert(Letters,FLetter)
			end
		end
	end	
	
	for _, FLetter in pairs(Letters) do	
		FLetter.Name = tonumber(FLetter.Name) + 1
	end

	LetterLabel.Parent = Line.Text
	
	if OwnInput == true then
		LineAPI:FocusTo(LineNumber,Position+2)
	end
end

Btw, it’s a script editor plugin I’m experimenting with at the moment so mind some of the lousy techniques
I’m using.

I already know I have some of my own errors but when i check the GUI that I re-parent to StarterGui. The UIListLayout is not correctly ordered.

To check the UI, make sure you have a script selected, press the toggle button and run the command in the executor: game.CoreGui.EditorUI.Parent = game.StarterGui
Then check inside the location EditorUI>Content>1>Text

Can you provide a more minimal RBXM of the problematic GUI and steps to reproduce the issue?

3 Likes

Oh, excuse me, what I was saying was nonsense. I realized that this was indeed expected behavior.

I thought name order would work the same as doing number order but I realized the reason it didn’t work was because the order works like this: 1,10,11,12,2,3,4,5,6,7,8,9

Sorry for using your time up. :stuck_out_tongue:

Oh, yes. It’s alphabetical ordering.

We were originally planning on adding a lexicographic ordering which would handle numbers, but we ended up introducing LayoutOrder instead which works a lot better.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.