Sign in Join
FPDoc Onlineexperiment

TCustomDBGrid.DrawFocusRect procedure

Member of TCustomDBGridprotectedIn unit DBGrids

Draws the current selection in the grid in a focused state.

Declaration

pascal
procedure DrawFocusRect(aCol: Integer; aRow: Integer; ARect: TRect)
 ; override

Arguments

aCol

Column number for the cell drawn with the focus rectangle.

aRow

Row number for the cell drawn with the focus rectangle.

ARect

Rectangle for the focus "rubberband" calculated in the method.

Description

DrawFocusRect is an overridden procedure used to draw the current selection in the grid in a focused state.

The grid control must have focus before the current selection can be drawn. In addition the DataLink for the control must refer to an active dataset. DrawFocusRect checks the Options property to ensure that dgAlwaysShowSelection has been included for the control. Finally DefaultDrawing must be enabled to allow drawing of the focus rectangle using the rubber band style on the Canvas for the control.

If any of the previous conditions are not met, no actions are performed in the method.

DrawFocusRect calls CalcFocusRect to get the bounds for the focus rectangle adjusted for optional grid lines. The DrawRubberRect method is called to render the focus rectangle with the needed borders using the FocusColor for the control.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.