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

# TCustomGrid.AddSelectedRange

Adds the current range selection to the array of selection rectangles for the control.

## Declaration

Source position: grids.pas line 977

`protected procedure TCustomGrid.AddSelectedRange;`

## Description

AddSelectedRange is a method used to add the rectangle for the current range selection to the internal member used to store the selection rectangle(s). It increases the capacity for the member and appends the value for the current selection rectangle.

No actions are performed in the method if goRangeSelect has not been included in the Options property, or when RangeSelectMode has a value other than rsmMulti.

Use ClearSelections to remove range selection rectangle(s) stored using AddSelectedRange.

AddSelectedRange is called from MouseDown when a Ctrl+Click or Meta+Click (macOS) mouse event occurs in the data area for the grid and range selection has been enabled for the control. Precautions have been taken in the calling procedure to avoid adding the same cells to more than one selection range. There are some combinations of user commands, however, where this cannot be eliminated completely.

## See also

TCustomGrid.Options |  | Contains the set of optional features and/or behaviors enabled for the grid control.
TCustomGrid.RangeSelectMode |  | Controls the range selection mode used for the grid.
TCustomGrid.HasMultiSelection |  | Indicates if multi-select range selection mode is enabled and in use for the grid.
TCustomGrid.ClearSelections |  | Clears the current range selection(s) and redraws the grid control.
TCustomGrid.MouseDown |  | Handles mouse down events for the grid control.
TGridOptions |  | Set type used to store enabled grid options.
TGridOption |  | Represents grid option values available for grid controls.