Delphi FMX TListBox slow with large lists

  

I’m loading 2,000 names into an FMX TListBox and it is taking far too long (like 35 seconds or more).
Here is the test code:
procedure TDocWindow.DEBUGAddLotsOfStringsToList;
var
theTimeAtStart: Integer;
J: Integer;

begin
ListBox1.Clear;

theTimeAtStart := TThread.GetTickCount;

for J := 1 to 2200 do
begin
ListBox1.Items.Add(j.toString);
end;

ShowMessage(‘There were ‘ + J.ToString + ‘ strings added to the list in ‘ + (TThread.GetTickCount – theTimeAtStart).ToString + ‘ milliseconds.’);
end;

Is there something about TListBox that makes it too slow for a few thousand strings?

Comments are closed.