
(*
 Delphi Object and Component Reference
# {bmc bm9.BMP} Pack example
This example assumes there are two edit box controls on the form. The code creates a list object and adds two strings to it. The second string in the list is a null string. The code counts the number of strings in the list and displays the number in the Edit1 control. The code then packs the list, removing the null string, and counts the strings in the list again. The second count displays in the Edit2 control:
*) 
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  TList *MyList = new TList;
  MyList->Add("A string"); //Add a string
  MyList->Add(""); // Add an empty string
  MyList->Add(NULL); //Add NULL
  MyList->Add(""); // Add another empty string
  Edit1->Text = IntToStr(MyList->Count); // Put count into Edit1
  MyList->Pack();                        // Pack the list.
  Edit2->Text = IntToStr(MyList->Count); // Put count into Edit2
  delete MyList;  // Free memory for list
} 
