After a research of the current ListView code I suggest a few changes, that unify the use of an ListView in general.

1) "AllocBy" is a stupid Delphi invention, that better should become "Capacity". The Capacity property can have a more specific meaning, not restricted to virtual (OwnerData) listviews, and for compatibility reasons the AllocBy property can become an alias for Capacity.

2) A "Count" property can be added, that reflects the current number of listview items. At least in non-virtual mode it should retrieve that number from the widget, to prevent sychnronization problems. When no widget exists yet, or the widget doesn't support such a method, the number of cached listview items can be returned instead (widgetset specific implementation, as for Capacity).

3) The current cache of *all* (predefined) listview items should be used/implemented properly. When the widget can be created only after reading *all* properties, including the predefined items, there exists no need to duplicate all these items in the widget, i.e. the widget can run in OwnerData mode internally. Otherwise the item list can be cleared after the items have been copied into the widget.

3a) In OwnerData mode the ListItems should cache the *actually* required range of items, visible in the widget. That range should be under control of the widget or user code, depending on the amount of work and memory for the creation of the cached items. A default TVirtualListView class can implement an default cache, eventually with an accordingly equipped item list class.

4) Many methods can be removed from the current code. In detail the construction and destruction of the cached items deserves no special handling, when the ListItems are used as a cache *only*. (see 3).


I'm willing to implement above steps, if there exists any interest. Since I don't have access to an Mac, can somebody shed some light on the requirements of that platform, which may conflict with above topics?

Or is the Lazarus team not interested at all, in a *working* implementation of the listview control? At least I'm missing any response on my recent patches and messages :-[

DoDi


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to