Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi Maximale Anzahl von Items (https://www.delphipraxis.net/216561-maximale-anzahl-von-items.html)

DelphiUser123 18. Jan 2025 12:42

Maximale Anzahl von Items
 
Hallo liebes Forum.
Ich habe folgende simple Frage: Wie viele Einträge passen heutzutage maximal in eine Delphi Listbox?

Uwe Raabe 18. Jan 2025 12:50

AW: Maximale Anzahl von Items
 
1000 - es sei denn sie ist virtual.

himitsu 18. Jan 2025 13:01

AW: Maximale Anzahl von Items
 
mehr passen schon rein, aber ab 'ner Million kann das doch keiner mehr bedienen.

Uwe Raabe 18. Jan 2025 13:33

AW: Maximale Anzahl von Items
 
Zitat:

Zitat von himitsu (Beitrag 1545354)
mehr passen schon rein

Das sieht Microsoft aber anders (Hervorhebung von mir):

Zitat:

LBS_NODATA
Specifies a no-data list box. Specify this style when the count of items in the list box will exceed one thousand. A no-data list box must also have the LBS_OWNERDRAWFIXED style, but must not have the LBS_SORT or LBS_HASSTRINGS style.
A no-data list box resembles an owner-drawn list box except that it contains no string or bitmap data for an item. Commands to add, insert, or delete an item always ignore any specified item data; requests to find a string within the list box always fail. The system sends the WM_DRAWITEM message to the owner window when an item must be drawn. The itemID member of the DRAWITEMSTRUCT structure passed with the WM_DRAWITEM message specifies the line number of the item to be drawn. A no-data list box does not send a WM_DELETEITEM message.

Kas Ob. 19. Jan 2025 08:45

AW: Maximale Anzahl von Items
 
Zitat:

Zitat von DelphiUser123 (Beitrag 1545352)
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.


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:44 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz