Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attaching an object to an already existing ListItem?

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).

like image 404
user1580348 Avatar asked Dec 05 '25 06:12

user1580348


1 Answers

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;
like image 166
TLama Avatar answered Dec 07 '25 05:12

TLama