Bsp. Daten:
Delphi-Quellcode:
TDaten = class
private
sD1,
sD2 : String;
public
constructor Create(sD1, sD2 : String);
function ...
property D1 : String ...
end;
Füllen der Liste:
Delphi-Quellcode:
with lst.Items.Add do
begin
....
Data := Pointer(TDaten.Create('huhu', 'haha'));
end;
Freigeben wird alles in OnDeletion
Delphi-Quellcode:
procedure TForm.ListView1Deletion(Sender: TObject; Item: TListItem);
begin
TObject(Item.Data).Free;
end;
Bsp-Zugriff in OnSelectItem
Delphi-Quellcode:
procedure ...(Sender: TObject; Item: TListItem; Selected: Boolean);
begin
ShowMessage(TDaten(Item.Data).D1);
end;