ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
ShellControls.TJamShellList.OnCompare

Occurs when two items need to be compared during a sort of the list.

Syntax
Pascal
property OnCompare;

See TCustomListView.OnCompare The event can be used to customize the sorting of the TJamShellList.

The following example will sort the ShellList by "Size".

procedure TMainForm.ShellListCompare(Sender: TObject; Item1, Item2: TListItem;
 Data: Integer; var Compare: Integer);
var lSortCol: TShellColumnId;
begin
 if (ShellList.ViewStyle = vsReport) then exit;
 lSortCol := TShellColumns.Size;
 Compare := VariantCompare(TJamShellListItem(lItem1).AbsoluteItemIdList.GetPropertyValue(lSortCol),
    TJamShellListItem(lItem2).AbsoluteItemIdList.GetPropertyValue(lSortCol));
end;