TdxListViewCompareEvent Type
The item comparison procedural type.
Declaration
TdxListViewCompareEvent = procedure(Sender: TdxCustomListView; AItem1: TdxListItem; AItem2: TdxListItem; AData: TdxNativeInt; var ACompare: Integer) of object;
Parameters
Name | Type | Description |
---|---|---|
Sender | TdxCustomListView | The List View control that raised an item comparison event. |
AItem1 | TdxListItem | The first target list item. |
AItem2 | TdxListItem | The second target list item. |
AData | TdxNativeInt | Specifies a pointer to additional data for the custom comparison routine. |
ACompare | Integer | A result of the comparison. |
Remarks
The following table explains which ACompare parameter values correspond to specific comparison results:
Value | Description |
---|---|
A negative integer value | AItem1 is positioned before AItem2 . |
0 | AItem1 is positioned before AItem2 . |
A positive integer value | AItem is positioned after AItem2 . |
The following OnCompare event handler sorts items by captions in the specified sort order if the control displays columns:
procedure TForm1.dxListViewControl1Compare(Sender: TdxCustomListView; AItem1,
AItem2: TdxListItem; AData: Integer; var ACompare: Integer);
begin
ACompare := CompareStr(AItem1.Caption, AItem2.Caption);
if (Sender.ViewStyle = TdxListViewStyle.Report) and (Sender.Columns.Count <> 0) then
if Sender.Columns[0].SortOrder = soDescending then
ACompare := ACompare * -1;
end;
The List View’s OnCompare event references the TdxListViewCompareEvent type.
See Also