Saturday, December 2, 2017

DELPHI - How add items to TListView

Listview has 2 columns. First column value is added by Caption property, second by SubItems list.
var
  List: TListView;
  pItem : TListItem;
begin
  ..
  { first item }
  pItem := List.Items.Add;
  pItem.Caption := 'Total record count';
  pItem.SubItems.Add( IntToStr( FLocalData.TotalRecordCount ) );
  pItem.ImageIndex := 0;
  pItem.Selected := true;

  { second item }
  pItem := List.Items.Add;
  pItem.Caption := 'Record count';
  pItem.SubItems.Add( IntToStr( FLocalData.RecordCount ) );
  pItem.ImageIndex := 0;
  ..
end;

No comments:

Post a Comment