unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Edit2: TEdit;
    Edit3: TEdit;
    Label2: TLabel;
    Button1: TButton;
    Label3: TLabel;
    Label4: TLabel;
    Edit4: TEdit;
    Edit5: TEdit;
    Label5: TLabel;
    Button2: TButton;
    Label6: TLabel;
    procedure Button2Click(Sender: TObject);
    procedure Edit5KeyPress(Sender: TObject; var Key: Char);
    procedure Edit4KeyPress(Sender: TObject; var Key: Char);
    procedure Button1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var L1,L2:integer;
begin
   L1:=StrToInt(Edit2.Text);
   L2:=StrToInt(Edit3.Text);
   Label2.Caption:=Inttostr(L1+L2);

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Label5.Caption:='Suma='+IntToStr(StrtoIntDef(Edit4.Text,0)+StrToIntDef(Edit5.Text,0))
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then  Label1.Caption:=Edit1.Text;
end;

procedure TForm1.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then Edit5.SetFocus; // po naciśnięciu klawisza Enter w okienku Edit4
                                   // aktywne staje się okienko Edit5
end;

procedure TForm1.Edit5KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then Button2.SetFocus; // po naciśnięciu klawisza Enter w okienku Edit5
                                     // aktywny staje się przycisk Button2
end;

end.
