Recent

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

masonwheeler

  • 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?

Marc

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

workaround:
Code: [Select]

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


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

oraitecamonyes

  • New Member
  • *
  • Posts: 31
    • http://blog.ptvet.com
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