Hi folks,

I am testing some code ported from Delphi.
I have discovered a bug in the Lazarus TCheckListBox implementation.
If you create a new application in Windows and add TCheckListBox with few items 
in it, the OnClickCheck event is fired before the new item is selected, and the 
new check status is assigned:

procedure TForm1.CheckListBox1ClickCheck(Sender: TObject);
begin
  if( CheckListBox1.ItemIndex >= 0 ) then
    begin
    if( CheckListBox1.Checked[ CheckListBox1.ItemIndex ] ) then
      CheckListBox1.Items[ CheckListBox1.ItemIndex ] := 'Checked'

    else
      CheckListBox1.Items[ CheckListBox1.ItemIndex ] := 'Unchecked';

    end;

end;

Here is a test application I have uploaded:


www.mitov.com/CheckListBoxBug.zip

To reproduce just click on the check box of a non selected item.

This aside from being different than the Delphi version effectively renders the 
OnClickCheck largely useless.
I have not tested it in Linux yet.

With best regards,
  Boian Mitov
 
-------------------------------------------------------
Mitov Software
www.mitov.com
-------------------------------------------------------
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to