[Lazarus] testing virtual TListView in gtk2

Andrew Haines AndrewD207 at aol.com
Wed Dec 2 04:33:21 CET 2009


Paul Ishenin wrote:
>>   
> ListViews on gtk can't be absolutely virtual - they need to have all the
> items. But captions, checks, etc are not stored in it (in the case of
> virtual) - they are requested before the drawing. So you should have
> some memory reduction in comparition with the real listview.
> 
> Only windows has real virtual listview. Other widgetsets have only
> compatible interface (your first test), not the implementation (storage
> organisation - your second test).
> 

I recently did a test where I wrote my own gtktreemodel (the container
for gtk treeview/listview data) I wrapped it around a TStrings object so
that the data was only stored in the StringList. This could be done for
a listview as well with really only a  small change.

Right now I think it works like this

1. GtkTreeView asks model (GtkListStore) for data
2. model finds pointer to TListItem and calls custom procedure to with
(TListItem) to get the data it needs.
3. GtkTreeView paints item.


with our own treemodel it could be

1. View asks model(TLCLListViewModel) for data
2. Model acceses TListItems for the data it needs.
3. GtkTreeView paints item.

The only major benefit I see is there is not a secondary list stored of
the TListItems.

I did a small test loading a text file with 50,000+ lines with my custom
model and the GtkTreeView retrieved the value of each item in the list
on startup. I assume it's to calculate the size for the scrollbar since
the height of the listitems is not fixed but can vary per row in the
GtkTreeView.

Would this help virtual treeview in any way?


Regards,

Andrew





More information about the Lazarus mailing list