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

# TCustomGrid.CalcFocusRect

Calculates the bounds for a focus rectangle in the grid control.

## Declaration

Source position: grids.pas line 989

`protected procedure TCustomGrid.CalcFocusRect(`
`var ARect: TRect;`
`adjust: Boolean = True`
`);`

## Arguments

`ARect` |  | TRect instance where the adjusted row or cell selection is stored.

## Description

When row selection is enabled in the grid Options, the Left and Right values in ARect are updated to use cached grid information in GCache. Calls FlipRect to account for Right-to-Left alignment when needed.

Adjust indicates whether values in ARect are adjusted for horizontal or vertical grid lines drawn in the control. No additional actions are performed when Adjust is set to False. The default value for the parameter is True.

When goHorzLine is included in Options, the Bottom value in ARect is decremented to accommodate the horizontal grid line.

When goVertLine is included in Options, the Left or Right value in ARect is adjusted to accommodate the vertical grid line. Left is incremented when UseRightToLeftAlignment is set to True. Right is decremented when UseRightToLeftAlignment is set to False.

CalcFocusRect is called from the DrawRow and DrawFocusRect methods.

## See also

TCustomGrid.Options |  | Contains the set of optional features and/or behaviors enabled for the grid control.
TCustomGrid.DrawRow |  | Draws the columns for the specified row in the grid control.
TCustomGrid.DrawFocusRect |  | Draws the focus rectangle for the specified cell.
TCustomGrid.GCache |  | Contains cached data about the visual layout and state for the grid control.
TCustomGrid.FlipRect |  | Flips coordinates for the specified cell rectangle when BiDiMode or RTL alignment is used.
TGridFlagsOption |  | Represents state flags used in a grid control.
TControl.UseRightToLeftAlignment |  | True when BiDiMode is bdRightToLeft.