[Overview][Constants][Types][Classes][Index] | Reference for unit 'fgl' (#rtl)

# TFPGMapInterfacedObjectData.OnDataCompare

Compare function for data values.

## Declaration

Source position: fgl.pp line 434

`public property TFPGMapInterfacedObjectData.OnDataCompare : TDataCompareFunc read FOnDataCompare write SetOnDataCompare;`

## Description

OnDataCompare can be set to a function that compares data values. The default value for this event is a function that compares data based on a byte-by-byte comparison of the memory block. The function must have the following semantics:

- If the result of this function is negative, the first data item (Data1) is assumed to be 'less' than the second data item (Data2) and will be moved before the second in the list.
- If the function result is positive, the first data item (Data1) pointer is assumed to be 'greater than' the second data item (Data2)and will be moved after the second in the list.
- if the function result is zero, the data items are assumed to be 'equal' and no moving will take place.

## See also

TFPGMapInterfacedObjectData.OnKeyCompare |  | Compare function for key values.