[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Grids' (#lcl)

# TOnCompareCells

Specifies an event handler signalled to compare cell values.

## Declaration

Source position: grids.pas line 361

`type TOnCompareCells = procedure(`
`Sender: TObject;`
`ACol: Integer;`
`ARow: Integer;`
`BCol: Integer;`
`BRow: Integer;`
`var Result: Integer`
`) of object;`

## Arguments

`Sender` |  | Control generating the event notification.
`ACol` |  | Column number for the first compared cell value.
`ARow` |  | Row number for the first compared cell value.
`BCol` |  | Column number for the second compared cell value.
`BRow` |  | Row number for the second compared cell value.
`Result` |  | Relative sort order for the compared values.

## Description

TOnCompareCells specifies an event handler signalled to compare the cells at the coordinates in ACol, ARow, BCol, and BRow. ACol and ARow are the column and row numbers for the first value in the comparison. BCol and BRow are the column and row number for the second value in the comparison.

Result is a variable Integer argument used to return the relative sort order for the compared values. The event handler must perform the actions needed to compare the cell values, and set the value in Result accordingly. Result should contain the following values:

-1
  The cell value at ACol, ARow occurs before the value at BCol, BRow
0
  The compared cells contain the same values
1
  The cell value at ACol, ARow occurs after the cell value at BCol, BRow

TOnCompareCells is the type used to implement the OnCompareCells in TCustomGrid.

## See also

TCustomGrid.OnCompareCells |  | Event handler signalled to compare the content in grid cells.