Author Topic: Another n00b question: TListView.AddItem  (Read 6333 times)


  • New Member
  • *
  • Posts: 19
Another n00b question: TListView.AddItem
« on: July 05, 2007, 02:50:28 am »
Still trying to port my Delphi project to Lazarus, and the compiler chokes when I try to call the AddItem method of a TListView control.  Apparently it doesn't exist.

This method is used to add an item to the list at runtime.  The Delphi declaration is:
Code: [Select]
procedure TCustomListView.AddItem(Item: String; AObject: TObject);

What's the equivalent for the LCL version?


  • Administrator
  • Hero Member
  • *
  • Posts: 2514
RE: Another n00b question: TListView.AddItem
« Reply #1 on: July 05, 2007, 11:40:48 am »
hmm... I thought I had seen it when implementing.

Code: [Select]

  Item: TListItem;
  Item := listview.items.add;
  Item.Caption := 'some text';
  Item.Data := AObject;

PS. Can you bugrep this (if not done already)
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker


  • New Member
  • *
  • Posts: 31
RE: Another n00b question: TListView.AddItem
« Reply #2 on: March 05, 2008, 08:33:38 pm »
sorry for waking up this dead thread, but i cant find the way to add items to a TListview
in delphi i usually do it like Marc says ...

(im using a TKOLListview)


TinyPortal © 2005-2018