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

# TCustomGrid.Selection

Rectangle with the current cell selections in the grid control.

## Declaration

Source position: grids.pas line 1293

`protected property TCustomGrid.Selection : TGridRect read GetSelection write SetSelection;`

## Description

Selection is a TGridRect property with the column and row numbers for the current cell selection in the grid control. The Left and Right members in the property value are column numbers for the cells in the selection. The Top and Bottom members in the property value are row numbers for the cells in the selection.

Selection is used when goRangeSelect has been included in the Options for the grid.

When a new grid rectangle is assigned for the property, the member values in the rectangle are normalized to ensure they are in the acceptable range of values for the grid control. If all four members have negative values, the current Selection is cleared by calling ClearSelection.

Column or row numbers in the rectangle are adjusted to exclude FixedCols and FixedRows.When goSelectionActive has been included in the grid Options, the current selection is extended to include the new selection range. The Invalidate method is called to redraw the grid control with the new Selection value.

A value assigned to Selection is ignored when goRangeSelect has not been included in the Options for the grid.