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

# TCustomButton.WSSetText

Notifies the widgetset class of a change to the caption text for the control.

## Declaration

Source position: stdctrls.pp line 1241

`protected procedure TCustomButton.WSSetText(`
`const AText: string`
`); override;`

## Arguments

`AText` |  | New value for the caption text in the control.

## Description

WSSetText is an overridden method used to notify the widgetset class instance when the value in the caption text has been changed. No actions are performed in the method when the handle for the control has not been allocated, or at design-time.

WSSetText ensures that Ampersand (&) characters used to define an accelerator key in AText are handled for the widgetset class. The Ampersand character(s) are removed from AText, and the virtual key code equivalent is stored in the Shortcut property. By default, the Shortcut uses the ssAlt shift modifier for the accelerator key.

The SetShortCut method in the widgetset class is called to store values from both Shortcut and ShortCutKey2.

The inherited WSSetText method is called prior to exit.

## See also

TCustomButton.Shortcut |  | Shortcut key for the control.
TCustomButton.ShortCutKey2 |  | Secondary shortcut key for the control.
TControl.Text |  | String with the text or caption for the control.
TControl.Caption |  | The text displayed for the control.
ShortCut |  | Converts a virtual key code and modifier to a shortcut value.
Char2VK |  | Gets the virtual key code for the specified character value.