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

# TCustomGrid.FadeUnfocusedSelection

Indicates if a special color is used for selected cells when the control loses focus.

## Declaration

Source position: grids.pas line 1290

`protected property TCustomGrid.FadeUnfocusedSelection : Boolean read FFadeUnfocusedSelection write SetFadeUnfocusedSelection default False;`

## Description

FadeUnfocusedSelection is a Boolean property which indicates if inactive caption and text colors are used to draw the selected cells in the grid when the control loses focus. It causes color values for the Brush and Font on the Canvas to be updated.

When set to True and the control is not Focused, an sRGB color difference between the Font color and the clBtnFace color is used to select the color values applied to the Canvas. If the color distance at least 25%, clBtnFace is used for the background and clBtnText is used for the text. For a smaller color distance, clInactiveCaption is used for the background and clInactiveCaptionText is used for the text.

When set to False, or when the control has Focus, the color in SelectedColor is used for the background in selected cells and the color assigned to Font is used for text.

The default value for the property is False. Changing the value for the property causes the control to be redrawn.

FadeUnfocusedSelection has no effect on cells which use a button-style editor; they are drawn using the style and color values needed for the button control.

FadeUnfocusedSelection is used in the PrepareCanvas method to assign the Brush and Font colors used on the Canvas.

## See also

TCustomGrid.DisabledFontColor |  | Color used to draw text in the grid when Enabled is set to False.
TCustomGrid.Focused |  | Indicates if the grid is focused or has an active focused cell Editor.
TCustomGrid.FocusColor |  | The color used to draw the focus rectangle when a cell has focus.
TCustomGrid.SelectedColor |  | Color used for selected cells in the grid.
TCustomGrid.PrepareCanvas |  | Prepares the canvas for drawing the cell at the specified location.
TCustomGrid.OnPrepareCanvas |  | Event handler signalled to prepare the Canvas to draw the grid.
TCustomControl.Canvas |  | The drawing surface for the control.
clBtnFace |  | Color for a button face.
clBtnText |  | The color for the text or other raised area on a button.
clInactiveCaption |  | One of the System colors.
clInactiveCaptionText |  | One of the System colors.