unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm2 = class(TForm)
    Panel1: TPanel;
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation
uses unit1;
{$R *.DFM}

procedure TForm2.Button1Click(Sender: TObject);
begin
form1.listbox1.Items.Add(form2.edit1.text);
form1.Memo1.Lines.Add(form2.edit1.text);
form2.Edit1.Clear;
form2.Close;
end;

procedure TForm2.Button2Click(Sender: TObject);
begin
form1.listbox1.Items.Add(form2.edit1.text);
form1.Memo1.Lines.Add(form2.edit1.text);

form2.Edit1.Clear;
end;

procedure TForm2.Button3Click(Sender: TObject);
begin
form2.Edit1.Clear;
form2.close;
end;

procedure TForm2.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then button1click(nil);
end;

procedure TForm2.FormActivate(Sender: TObject);
begin
edit1.SetFocus;
end;

end.
