How to not load all database records in my TListbox in Firemonkey Delphi XE8

596 views Asked by At

I have a multi device project in Delphi Xe8. I have a TListBox component that i load with database records.

The problem is that sometimes the list can be really big and so the loading will take long. So I want to load it partially and when I scroll down load new records. How do I do that?

Right now i load every record of my table using a TFDQuery.

Update: After some timing I have realized that the problem doesn't lay with loading all the records from the database, but rather with creating all the TListBoxItems in the TListBox. So I still want to do pretty much the same, but now load all the database records but not create TListBoxItems for all of them.

1

There are 1 answers

1
RBA On

From the Embarcadero wiki on TFDQuery you can set the BlockReadSize

For BDE-enabled datasets, setting BlockReadSize also causes the dataset to fetch database information in blocks of BlockReadSize records, which it then buffers. This minimizes traffic between your application and the database server.

Another thing you can try are the FetchOptions of the TFDQuery which have RowSetSize property

I don't have at the moment FireMonkey so I can test this.