#include <vcl.h>
#include "MyForm3.h"
#pragma resource "*.dfm"

TMyForm3 *MyForm3;

__fastcall TMyForm3::TMyForm3(TComponent* Owner) : TForm(Owner)
{
  AddText = new TButton(this);
  AddText->Parent = this;
  AddText->Left = 20;
  AddText->Top = 20;
  AddText->Caption = "Add text";

  Edit = new TEdit(this);
  Edit->Parent = this;
  Edit->Left = AddText->Left + AddText->Width + 5;
  Edit->Top = AddText->Top;
  Edit->Width = 150;

  ListBox = new TListBox(this);
  ListBox->Parent = this;
  ListBox->Left = AddText->Left;
  ListBox->Top = AddText->Top + AddText->Height + 5;
  ListBox->Width = AddText->Width + Edit->Width + 5;
  ListBox->Height = 100;

  AddText->OnClick = ClickButton;
}

void __fastcall TMyForm3::ClickButton(TObject *)
{
  ListBox->Items->Add(Edit->Text);
}
