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

# TCustomGrid.SetColRow

Makes the specified column and row a selected cell in the grid control.

## Declaration

Source position: grids.pas line 1188

`protected procedure TCustomGrid.SetColRow(`
`const ACol: Integer;`
`const ARow: Integer;`
`withEvents: Boolean = False`
`);`

## Arguments

`ACol` |  | Column number for the selected cell.
`ARow` |  | Row number for the selected cell.
`withEvents` |  | True if the OnClick event handler is signalled for the change to the selected range.

## Description

ACol and ARow contain the coordinates for the cell affected in the method.

WithEvents indicates whether the specified cell is added to the Selections for the grid control, or if it becomes the selected cell.

When WithEvents is set to True, MoveExtend is called to add the cell to the current range. This also causes the Click method to be called to signal the OnClick event handler (when assigned).

When WithEvents is set to False, argument values are assigned to the Col and Row properties in the grid control. UpdateSelectionRange is called to update the cell rectangle for the cell or row selection.

## See also

TCustomGrid.Col |  | Column index for the selected grid cell.
TCustomGrid.Row |  | Row number for the selected grid cell.
TCustomGrid.UpdateSelectionRange |  | Updates the selection range when the current selection in the grid has changed.
TCustomGrid.MoveExtend |  | Moves the selected cell or extends a selection using the specified column and row values.
TCustomGrid.Click |  | Performs actions needed when a mouse click occurs in the grid control.