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

TCustomCheckBox.State

The check, unchecked, or grayed state for the control.

Declaration

Source position: stdctrls.pp line 1360

public property TCustomCheckBox.State : TCheckBoxState
  read GetState
  write SetState
  default cbUnchecked;

Description

State is a TCheckBoxState property which indicates whether the check box is checked, unchecked or grayed (disabled). The default value for the property is cbUnchecked. State allows the control to be set to the indeterminate (grayed) state when AllowGrayed is set to True. Otherwise, it is the same as using the Checked property.

Reading the property value calls RetrieveState to get the value from the widgetset class when its handle has been allocated. Otherwise, the existing value for the member is used. Changing the value for the property causes ApplyChanges to be called to send the new property value to the widget.

See TCheckBoxState for the available enumeration values and their meanings in the State property.

See also

TCustomCheckBox.RetrieveState

  

Gets the checked state for the control from the widgetset class.

TCustomCheckBox.ApplyChanges

  

Sets the checked state in the widgetset class and redraws the control.

TButtonControl.Checked

  

Indicates the checked state for the control.

TCheckBoxState

  

Represents the states for a check box.

Example

{ This example uses a check box on a form. When the application runs, 
  the check box is initially checked. When the user clicks it,
  the check box is unchecked. Clicking it again grays the check box. }
procedure TForm1.FormCreate(Sender: TObject);
begin
  Checkbox1.AllowGrayed := True;
  Checkbox1.State := cbChecked;
end;