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

# TCustomGrid.ClearSelections

Clears the current range selection(s) and redraws the grid control.

## Declaration

Source position: grids.pas line 1344

`public procedure TCustomGrid.ClearSelections;`

## Description

ClearSelections is a method used to remove all selection rectangles in an internal member for the grid control. These are the values stored using AddSelectedRange when multi-selection is enabled in the Options for the control.

ClearSelections clears the internal storage for selection ranges and calls UpdateSelectionRange to reset the current selection on the control. The selected range is an empty rectangle (where Left, Top, Bottom, and Right members are -1) when ColCount and RowCount contain 0 (zero).

When goRowSelect has been included in Options, a range selection for all non-fixed cells in the current row is created. The pivot point (selection anchor) for extending the range selection is set to the values in Col and Row.

ClearSelections calls InvalidateGrid to redraw the grid control when another update is not already in progress.

ClearSelections is called from the Clear method, and when a new value is assigned to the RangeSelectMode property. It is also called from the MouseDown method when a range selection is handled for the non-fixed area on the grid control.

## See also

TCustomGrid.Clear |  | Clears all cells in the grid control.
TCustomGrid.Options |  | Contains the set of optional features and/or behaviors enabled for the grid control.
TCustomGrid.Col |  | Column index for the selected grid cell.
TCustomGrid.Row |  | Row number for the selected grid cell.
TCustomGrid.RangeSelectMode |  | Controls the range selection mode used for the grid.
TCustomGrid.AddSelectedRange |  | Adds the current range selection to the array of selection rectangles for the control.
TCustomGrid.UpdateSelectionRange |  | Updates the selection range when the current selection in the grid has changed.
TCustomGrid.InvalidateGrid |  | Invalidates the client area for the grid control.
TCustomGrid.MouseDown |  | Handles mouse down events for the grid control.