I came across some unexpected behaviour of TListItem. Check the following test code:
var
Item: TListItem;
//...
ListView1.Checkboxes := True;
with ListView1.Items.Add do
begin
Caption := 'old item';
Checked := False;
end;
Item := TListItem.Create(ListView1.Items);
Item.Caption := 'new item';
Item.Checked := False;
ListView1.Items[0].Assign(Item);
Assert(ListView1.Items[0].Caption = 'new item');
Assert(ListView1.Items[0].Checked = False); //WTF
Assertion failure occurs, as Checked property somehow switches itself to True. I didn't find any remarks on this behaviour in the help file.
Is this a bug or a feature?
I'm using Delphi 7 with all updates.