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

# TCustomCheckBox

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The base class for a check box component.

## Declaration

Source position: stdctrls.pp line 1326

`type TCustomCheckBox = class(TButtonControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure Click; override;` |  | Performs actions needed when the control is clicked.
`procedure DoClickOnChange; virtual;` |  | Implements the Click behavior for the control.
`function RetrieveState;` |  | Gets the checked state for the control from the widgetset class.
`procedure InitializeWnd; override;` |  | Copies cached control properties to the newly created widget.
`procedure Toggle; virtual;` |  | Alternates between the checked and the unchecked state in the control.
`function DialogChar(); override;` |  | Implements support for accelerator keys in the control.
`function GetChecked; override;` |  | Gets the value for the Checked property.
`procedure SetChecked(); override;` |  | Sets the value for the Checked property.
`procedure RealSetText(); override;` |  | Sets the value for the Caption property.
`procedure ApplyChanges; virtual;` |  | Sets the checked state in the widgetset class and redraws the control.
`class function GetControlClassDefaultSize; override;` |  | Returns the default dimensions for new instances of the class.
`procedure Loaded; override;` |  | Performs actions needed after the control is loaded using LCL component streaming.
`procedure WSSetText(); override;` |  | Sets the value for the Text property in the widgetset class.
`procedure TextChanged; override;` |  | Performs actions needed when the CM_TEXTCHANGED message is handled for the control.
`procedure CreateParams(); override;` |  | Initializes the window creation parameter record with the settings for the control.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`property Alignment: TLeftRight; [rw]` |  | Indicates the alignment for the caption text in the control.
`property AllowGrayed: Boolean; [rw]` |  | Allows the check box to use a "grayed" state.
`property State: TCheckBoxState; [rw]` |  | The check, unchecked, or grayed state for the control.
`property ShortCut: TShortcut; [r]` |  | Shortcut key for the control.
`property ShortCutKey2: TShortcut; [r]` |  | Secondary shortcut key for the control.
`property OnChange: TNotifyEvent;` |  | Event handler signalled when the button control is clicked.
`end;`

## Inheritance

`TCustomCheckBox` |  | The base class for a check box component.
`TButtonControl` |  | Specifies a base class for button controls.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TCustomCheckBox is a TButtonControl descendant which specifies an interface used for a check box control. It is the common ancestor for TCheckBox, TToggleBox, TRadioButton, and TDBCheckBox descendants.

A check box control allows the user to choose the state for the control independent of other check box controls (unlike a radio button). TCustomCheckBox introduces the State property which contains the check, unchecked, or grayed state for the control. The AllowGrayed property indicates if the grayed state is allowed in the control; otherwise only checked and unchecked are used. The Checked property allows the value in State to be updated by setting a Boolean value that indicates the check or unchecked state for the control.

## See also

TButtonControl |  | Specifies a base class for button controls.
TCheckBox |  | A label with a box which can contain a check mark.
TToggleBox |  | A labelled box capable of being checked or unchecked.
TRadioButton |  | Implement a radio button control.
TDBCheckBox |  | Implements a data-aware check box control.