//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "SubItems.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: TListItemSubItems
// Property: ComCtrls.TCustomListView.Columns
// Property: ComCtrls.TListColumn.Caption
// Property: ComCtrls.TCustomListView.Items
// Property: ComCtrls.TListItem.SubItems
// Method: ComCtrls.TListItems.Add
// Property: ComCtrls.TCustomListView.ViewStyle
// Method: ComCtrls.TCustomListView.Create

// BeginCode
/*
This example requires only a blank form.  All other objects:
TListView, TListColumns, TListItems, are created dynamically.
You must add comctrls to the uses defs file.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  const char Names[6][2][10] = 
   {{"Rubble","Barny"},
    {"Michael", "Johnson"},
    {"Bunny", "Bugs"},
    {"Silver", "HiHo"},
    {"Simpson", "Bart"},
    {"Squirrel", "Rocky"}};

  TListColumn  *NewColumn;
  TListItem  *ListItem;
  TListView   *ListView = new TListView(this); // The owner will clean this up.

  ListView->Parent = this;
  ListView->Align = alClient;
  ListView->ViewStyle = vsReport;
  NewColumn = ListView->Columns->Add();
  NewColumn->Caption = "Last";
  NewColumn = ListView->Columns->Add();
  NewColumn->Caption = "First";
  for (int i = 0; i < 6; i++)
  {
    ListItem = ListView->Items->Add();
    ListItem->Caption = Names[i][0];
    ListItem->SubItems->Add(Names[i][1]);
  }
}
// EndCode
// EndExample: TListItemSubItems
//---------------------------------------------------------------------------
