RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCheckBox.State Property

Indicates whether the check box is selected, deselected, or grayed.

Pascal
property State: TCheckBoxState;
C++
__property TCheckBoxState State;

Use State to determine whether the check box is checked (cbChecked), unchecked (cbUnchecked), or grayed (cbGrayed).  

C++ Examples: 

 

/*
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.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  CheckBox1->AllowGrayed = true;
  CheckBox1->State = cbChecked;
}

 

Delphi Examples: 

{
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;

 

AllowGrayed 

Checked

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!