Hallo liebes Forum.
Ich habe folgende simple Frage: Wie viele Einträge passen heutzutage maximal in eine Delphi Listbox?
Traditionally it was 32k (32*1024 to be exact), but this was in legacy and old Windows, now you can reach 64k with no problem.
try this
Delphi-Quellcode:
procedure TForm10.Button1Click(Sender: TObject);
const
EXTRA = 1;
//EXTRA = 50;
var
i: Integer;
begin
ListBox1.Items.BeginUpdate;
try
for i := 0 to 1024 * 32 * 2 + EXTRA do
ListBox1.Items.Add(IntToStr(i));
finally
ListBox1.Items.EndUpdate;
end;
end;
On my Windows 10 and My Delphi XE8 and with EXTRA at 50 it start to behave erratically when you drag the scrollbar in big steps to the end, but will show them (items) correctly if you used different way of scrolling like mouse wheel, and this might be a problem in
VCL and not in the
OS itself.
As for Microsoft suggestion, it is merely a best practice, with Windows themes and font scaling the cache used by the
OS does suffer with huge amount of items, thus the suggestion to switch to virtual mode, but this happen only with specific theming a long with specific scaling with small memory GPU cards.