baudewyns
asked on
Using Item.Data in TCustomListView
I got a EAccessViolation error at run time during termination of the program after adding items with an object or record attached on it.
If I clear the list using an embedded PopUp menu before termination, it's OK.
If I clear the list, from outside the component, using also the method Clear, it's not OK.
What's wrong ?
I hope my explanation clear enough.
Bob
If I clear the list using an embedded PopUp menu before termination, it's OK.
If I clear the list, from outside the component, using also the method Clear, it's not OK.
What's wrong ?
I hope my explanation clear enough.
Bob
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How to implement Deletion inside a new class derived from TCustomListView ?
it's always agood approach to be more carefull with such code and use the function assigned to see if the item.data is assigned.
try this code
procedure TForm1.ListView1Deletion(S ender: TObject; Item: TListItem);
begin
if Assigned(Item.Data) then
TObject(Item.Data).Free;
end;
try this code
procedure TForm1.ListView1Deletion(S
begin
if Assigned(Item.Data) then
TObject(Item.Data).Free;
end;
Regards, Madshi.