Check,box,list,methods,delphi

Omar 10/12/2016 0

This example demostrates the use of some Check box list methods. Example assumes you have a TCheckListBox and two buttons on the form.

Delphi
 procedure TMainForm.btCheckAllClick(Sender: TObject);
begin
  { Check all the check boxes in the list.
    Do not change the state of the dimmed check box }
  CheckListBox.CheckAll(cbChecked, false, true);
end;
 
procedure TMainForm.btUncheckAllClick(Sender: TObject);
begin
  { Uncheck all the check boxes in the list.
    Do not touch the disabled check boxes. }
  CheckListBox.CheckAll(cbUnchecked, true, false);
end;
 
procedure TMainForm.FormCreate(Sender: TObject);
begin
  { 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 dimmed state. }
  CheckListBox.AllowGrayed := true;
 
  { Make the first check box dimmed. }
  CheckListBox.State[0] := cbGrayed;
 
  { Make the second check box disabled. }
  CheckListBox.ItemEnabled[1] := false;
end; 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments