I am trying to use ItemEnabled property of CheckListBox and I found some problems using it.
Put a TCheckListBox on a form and on Create put this code:

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
begin
  for i:= 0 to 49 do
  begin
    CheckListBox1.Items.Append(Format('%d item', [i + 1]));
    if (i mod 2) = 0 then
      CheckListBox1.ItemEnabled[i]:= False;
  end;
end;

CheckListbox does not appear as expected, all the items are enabled.

Otherwise if I use the following code the Items are enabled or disabled correctly:

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
begin
  for i:= 0 to 49 do
  begin
    CheckListBox1.Items.Append(Format('%d item', [i + 1]));
  end;
end;

procedure TForm1.FormShow(Sender: TObject);
var
  i: integer;
begin
  for i:= 0 to 49 do
  begin
    if (i mod 2) = 0 then
      CheckListBox1.ItemEnabled[i]:= False;
  end;
end;



--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to