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

TCustomLabel.FocusControl

The control associated with the label and its accelerator key (AccelChar).

Declaration

Source position: stdctrls.pp line 1597

protected property TCustomLabel.FocusControl : TWinControl
  read FFocusControl
  write SetFocusControl;

Description

Set FocusControl to the control which is focused when the accelerator key in the label is pressed.

A label control cannot receive the input focus (it is read-only), but can display an accelerator key indicator, just like a menu entries. A windowed control (Edit...) can receive focus, but cannot indicate an accelerator key.

Using a combination of a label and another control allows setting the accelerator key in the label caption. The other control receives focus when the user presses the accelerator key.

An accelerator key is marked by an Ampersand '&' in the label caption, immediately preceding the character to be used as the accelerator key. The marked character appears underlined on screen, when ShowAccelChar is set to True.

For example: When you have a NameEdit1 control on a form, preceded by a label NameLabel1, you can set NameLabel1.FocusControl to NameEdit1, and NameLabel1.Caption to '&Name'.

See also

TCustomLabel.ShowAccelChar

  

Underlines the character in the label that acts as the accelerator or short cut key.


Version 3.2 Generated 2024-02-25 Home