TCustomShellListView.OnSortCompare property
Event handler signalled to perform a custom sort for the ObjectTypes in Items.
Declaration
property OnSortCompare: TFileItemCompareEvent read FOnSortCompare write SetOnSortCompare;Description
OnSortCompare is a TFileItemCompareEvent property with the event handler signalled to determine the sort order for the Items on the control. An application can implement and assign a routine with the signature in TFileItemCompareEvent to determine a custom sort order.
The object function in the handler must compare the file items in the Item1 and Item2 arguments, and return a value which indicates the relative sort order for the compared items; -1 when Item1 comes before Item2, 1 when Item1 comes after Item2, or 0 when Item1 and Item2 have the same values.
Changing the routine assigned to the property causes Items to be cleared, reloaded, and sorted using the new handler.
OnSortCompare is used in the PopulateWithRoot method, and passed as an argument to the helper routine used to gather and sort the file system objects in Items.
Set FileSortType to fstCustom to enable the OnSortCompare event handler.
Use ObjectTypes to indicate which file system objects are displayed on the list view.
Added in LCL version 5.0.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
