CheckListBoxCheckAll (C++)
Description
This example demostrates the use of some Check box list methods. Example assumes you have a TCheckListBox and two buttons on the form.
Code
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
/* Add a few check boxes to the list. */
CheckListBox->Items->Add("Option 1");
CheckListBox->Items->Add("Option 2");
CheckListBox->Items->Add("Option 3");
CheckListBox->Items->Add("Option 4");
/* Allow the user to set the check boxes into the grayed state. */
CheckListBox->AllowGrayed = true;
/* Make the first check box dimmed. */
CheckListBox->State[0] = cbGrayed;
/* Make the second check box disabled. */
CheckListBox->ItemEnabled[1] = false;
}
void __fastcall TMainForm::btCheckAllClick(TObject *Sender)
{
/* Check all the check boxes in the list.
Do not change the state of the dimmed check box. */
CheckListBox->CheckAll(cbChecked, false, true);
}
void __fastcall TMainForm::btUncheckAllClick(TObject *Sender)
{
/* Uncheck all the check boxes in the list.
Do not touch disabled check boxes. */
CheckListBox->CheckAll(cbUnchecked, true, false);
}
Uses
- Vcl.CheckLst.TCheckListBox.AllowGrayed ( fr | de | ja )
- Vcl.CheckLst.TCheckListBox.State ( fr | de | ja )
- Vcl.CheckLst.TCheckListBox.ItemEnabled ( fr | de | ja )
- Vcl.CheckLst.TCheckListBox.CheckAll ( fr | de | ja )