Refactoring of the List View Control in Seattle
Go Up to What's New in Seattle
The RAD Studio Seattle list view API was refactored. The list view and list view item components where divided into different layers to provide a list view API that is more flexible and easier to extend than in XE8.
These changes should barely affect projects that simply use the TListView component. However, these changes may notably affect projects that subclass a list view or list view item class.
Contents
TCustomListView Has Been Divided into Five Classes
TCustomListView
was split into the following classes that inherit each other:
As a result of this refactoring, many members were moved away from TCustomListView
, and new members were added to the new list view classes:
Also:
- Two new interfaces were created, IAppearanceItemOwner and IPublishedAppearanceOwner, which TAppearanceListView implements.
- The new implementation of the
Resize
procedure made theResizeAppearances
andResizeObjects
procedures unnecessary, and they have been removed. BeginAppearanceUpdate
andEndAppearanceUpdate
have been replaced by BeginUpdate and EndUpdate respectively.
TListViewItems Has Been Divided into Four Classes
TListViewItems
was moved into a new unit, FMX.ListView.Adapters.Base, and split into the following classes that inherit each other:
As a result of this refactoring, the following members were moved away from TListViewItems
:
Class or Unit | Members from TListViewItems
|
New Members |
---|---|---|
TAbstractListViewAdapter |
Public:
|
Public:
Protected: |
TFilterableListViewItems |
Public: |
Protected: |
TAppearanceListViewItems |
Public: Protected: |
Protected:
|
FMX.ListView.Types |
|
This refactoring also resulted in the creation of the following new interfaces that these classes of list view items implement:
Class | Interfaces |
---|---|
TListViewItems | |
TFilterableListViewItems | |
TAppearanceListViewItems |
Object Appearance Classes Have Been Moved to FMX.ListView.Appearances
The following classes have been moved to the FMX.ListView.Appearances unit:
- TAccessoryObjectAppearance
- TAppearanceObjects
- TCommonObjectAppearance
- TCustomAccessoryObjectAppearance
- TCustomGlyphButtonObjectAppearance
- TCustomImageObjectAppearance
- TCustomItemObjects
- TCustomTextButtonObjectAppearance
- TCustomTextObjectAppearance
- TEmptyItemObjects
- TGlyphButtonObjectAppearance
- TImageObjectAppearance
- TItemAppearanceObjects
- TItemAppearanceProperties
- TNullItemObjects
- TObjectAppearance
- TPresetItemObjects
- TTextButtonObjectAppearance
- TTextObjectAppearance
TListItemObject Has Been Renamed and Changed
TListItemObject has been renamed as TListItemDrawable, and exists now only as an empty subclass of TListItemDrawable
for backward compatibility.
In addition, TListItemDrawable
has undergone the following changes:
- The
FLocalRect
field has become the LocalRect property. - It provides a new function: InLocalRect.
- The visibility of CalculateLocalRect has changed from protected to public.
TListItemObjectClass has been moved to FMX.ListView.Appearances and it is now a class reference of TListItemDrawable.
TListItemObjects has been renamed as TListItemView, and exists now only as an empty subclass of TListItemView
for backward compatibility.
In addition, TListItemView
has undergone the following changes:
- The
ItemList
property has been renamed as ViewList. Also, its visibility has changed from protected to public. - The
Objects
property has been renamed as Drawables. - The FindObject function is now deprecated, use the new FindDrawable function instead.
- The ObjectByName function is not deprecated, use the new DrawableByName function instead.
- It provides a new procedure: Insert.
TListItem Has Undergone Some Changes
In TListItem:
- There are two new properties: Adapter, Index.
- The protected
FHeaderRef
fields has been replaced by the public HeaderRef property. - The
TListItemObjectsType
type has been renamed as TListItemViewType. - The
Objects
property has been renamed as View. - You can no longer use the
FParent
field to access the parent control of the item list that you pass to the constructor.
There Have Been Other Changes
- TCustomListView.ClearItems, which was already deprecated in XE8, has been removed. Use TCustomListView.Items.Clear instead.
- Appearances.TListViewItem has been moved to FMX.ListView.Appearances, and there is a new alias for it in
FMX.ListView.Appearances
: TAppearanceListViewItem. - The TListItemImage class provides a new procedure: FitInto.
- The IListItemStyleResources interface defines a new function: StyleResourcesNeedUpdate.
- The IListViewPresentationParent interface defines the following new methods: GetAdapter, GetItemClientRect, RebuildList. Also, DeleteItem now returns a boolean value that indicates whether the deletion succeeded or not.
- There is a new type, TListItemsList, which is an alias of TList<TListItem>.
- TAppearancesRegistry, a new class that contains some members that have been taken out of
TCustomListView
, provides an additional, new function: FindItemAppearanceObjectsClassByOption. - The visibility of the Owner property of TPublishedAppearance has changed from public to published.
- The
Owner
property of TPublishedObjects is no longer available.