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

# TCustomStaticText.ShowAccelChar

Indicates if an accelerator character is drawn in the displayed text.

## Declaration

Source position: stdctrls.pp line 1114

`public property TCustomStaticText.ShowAccelChar : Boolean read FShowAccelChar write SetShowAccelChar default True;`

## Description

ShowAccelChar is a Boolean property which indicates if the character used as an accelerator key is drawn with an underline in the control.

An accelerator is defined in Caption using a leading Ampersand (&) character. The character immediately after the Ampersand character sets the key value for the short cut. As an example: Setting Caption to '&User Name' causes Alt+U to be used as the accelerator key. Any occurrences of Ampersand (&) followed by a Space (#32) are not displayed in the Caption value.

To display an Ampersand character in Caption, it must be entered as two adjacent Ampersand characters (&&).

Set ShowAccelChar to True to enable underline drawing for the accelerator character. The default value for the property is True. Changing the value in the property causes the InvalidatePreferredSize method to be called to update the bounds for the control.

The value in ShowAccelChar is used in widgetset class methods, such as when the text value is assigned and when the handle for the control is created (or re-created).

Use FocusControl to specify the control which receives focus when the accelerator key is handled in DialogChar.

## See also

TCustomStaticText.FocusControl |  | The control that receives focus instead of this control.
TCustomStaticText.DialogChar |  | Handles an accelerator key for the control.
TCustomStaticText.GetLabelText |  | Returns the Caption for the control.
TControl.Caption |  | The text displayed for the control.
TControl.InvalidatePreferredSize |  | Marks the preferred size as invalid for this control and all parents (implies that we will look for another).