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

# TCustomGrid.RangeContains

Indicates whether the specified grid rectangle contains the specified cell coordinates.

## Declaration

Source position: grids.pas line 1166

`protected function TCustomGrid.RangeContains(`
`const ARange: TGridRect;`
`ACol: Integer;`
`ARow: Integer`
`):Boolean;`

## Arguments

`ARange` |  | Grid rectangle with the cell coordinates examined in the method.
`ACol` |  | Column number for the cell to locate in the specified rectangle.
`ARow` |  | Row number for the cell to locate in the specified rectangle.

## Function result

Returns True if the specified cell exists in the specified grid rectangle.

## Description

RangeContains is a Boolean function used to determine whether the grid rectangle specified in the ARange argument contains the cell specified in the ACol and ARow arguments. The return value is True if the TGridRect instance includes the specified cell coordinates; ACol must be between the Left and Right members (inclusive) in the rectangle, ARow must be between the Top and Bottom members (inclusive) in the rectangle.

RangeContains is called from the GetIsCellSelected method and occurs when the IsCellSelected property is examined during mouse down event handling and state draw operations for the grid control.

## Version info

Added in LCL version 4.5.

## See also

TCustomGrid.IsCellSelected |  | Provides indexed access to the selected state for a cell by its column and row number.
TCustomGrid.GetIsCellSelected |  | Gets the value for the indexed IsCellSelected property.
TCustomGrid.GetGridDrawState |  | Gets the grid drawing state for the cell with the specified column and row numbers.
TCustomGrid.MouseDown |  | Handles mouse down events for the grid control.
TCustomGrid.DrawRow |  | Draws the columns for the specified row in the grid control.