In a ListView, how can I attach an object at any time to an already existing ListItem? (I know I can attach an object to a ListItem with AddItem, however I need to attach the object after the ListItem has been created).
You can access it through the TListItem.Data property. For example:
var
ListItem: TListItem;
begin
ListView1.AddItem('Item 1', nil);
...
ListItem := ListView1.Items[0];
ListItem.Data := Edit1;
TEdit(ListItem.Data).Text := 'Updated text...';
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With