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

# TCustomGrid.DoCompareCells

Performs a comparison between the specified cells in the grid control.

## Declaration

Source position: grids.pas line 1024

`protected function TCustomGrid.DoCompareCells(`
`Acol: Integer;`
`ARow: Integer;`
`Bcol: Integer;`
`BRow: Integer`
`):Integer; virtual;`

## Arguments

`Acol` |  | Column number for the cell.
`ARow` |  | Row number for the cell.
`Bcol` |  | Column number for the cell.
`BRow` |  | Row number for the cell.

## Function result

Relative sort order for the compared cells.

## Description

DoCompareCells signals the OnCompareCells event handler (when assigned) to perform the comparison. The return value contains the relative sort order for the compared cells, and uses the following values:

-1
  The cell at ACol and ARow occurs comes before the cell at BCol and BRow.
0
  The specified cells have the same value.
1
  The cell at ACol and ARow occurs comes after the cell at BCol and BRow.

When OnCompareCells is not assigned, the return value is always 0.

## See also

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