Accelerate TListView (Views: 56)
The TListView control is very slow if it contains a large amount of items. How do you accelerate it?
One possibility is to use the functions
This is still not enough for very large ListViews with more than 20.000 Items. Here it is better to use virtual ListViews :
1. Set Listview.OwnerData to "true"
2. Use the OnData-Event of the Listview-Component, e.g. :
procedure TForm.ListViewData(Sender: TObject; Item: TListItem);
for n := 1 to FList.Count - 1 do
s := tStrings(FList[n])[Item.Index];
Of course you can not use TListView.AlphaSort to sort this kind of ListView. If you want to sort it, you have to write your own sort procedure.
The same method can be applied to accelerate TListBox Components with a large number of items:
set TListBox.Style to lbVirtual and use the OnData Event.
<< Back to main page