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

# TFPSListCompareFunc

Compare list items callback signature

## Declaration

Source position: fgl.pp line 42

`type TFPSListCompareFunc = function(`
`Key1: Pointer;`
`Key2: Pointer`
`):Integer of object;`

## Arguments

`Key1` |  | First key value
`Key2` |  | Second key value

## Function result

Is key1 less than key2

## Description

TFPSListCompareFunc is used in the TFPSList.Sort method to compare 2 elements. The list passes 2 pointers to the actual items to the compare function. The result of this function determines how the pointers will be sorted:

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

## See also

TFPSList.Sort |  | Sort the list