Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

checklistbox itemenabled

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

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;

Reply by email

Mattias Gaertner
to Andrea Mauri
Show quoted text 17 lines
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.

Fixed in svn revision 25352.

Mattias

Reply by email