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

# TCustomEdit.HideSelection

Determines if selected text to be hidden when the control does not have focus.

## Declaration

Source position: stdctrls.pp line 865

`public property TCustomEdit.HideSelection : Boolean read FHideSelection write SetHideSelection default True;`

## Description

HideSelection is a Boolean property which determines whether the selected text in the control is hidden when the control does not have focus.

HideSelection negates the default behavior in the edit control. The default behavior hides the selection when the control loses focus, and displays the text selection when the control receives focus. When set to False, the selected text (if any) is always displayed in the selected state - even when the control loses focus.

The default value for the property is True.

Changing the value for the property causes the SetHideSelection method in the widgetset class to be called when its handle has been allocated. No actions are performed in the method when the handle has not been allocated for the widgetset class.

The value in HideSelection is used in the CreateParams method to determine whether the ES_NOHIDESEL edit style flag is included in or omitted from the creation parameters for the control. When HideSelection is set to False, the ES_NOHIDESEL edit style is included in the flag values.

Use SelText, SelStart, and SelLength to change the text selection in program code. Use ClearSelection to remove the current text selection in the edit control.

Remark: | HideSelection is not supported for the GTK2, QT4, QT5, and QT6 widgetsets.

## See also

TCustomEdit.Text |  | The text displayed and edited for the control.
TCustomEdit.SelText |  | The currently selected text in the edit box for the control.
TCustomEdit.SelStart |  | The zero-based index for the first UTF-8 character in the current text selection.
TCustomEdit.SelLength |  | The number of currently selected UTF-8-encoded characters in the control.
TCustomEdit.ClearSelection |  | Clears the current text selection in the edit control.
TCustomEdit.CreateParams |  | Ensures the required creation parameters are set for handle creation.