unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    procedure Edit1Exit(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
{$R+} //RANGECHECKS ON
procedure TForm1.Edit1Exit(Sender: TObject);
var a:smallint;
begin
  try
   a:=StrtoInt((Sender as TEdit).text);
  except
   On E: EConvertError do
   begin
     ShowMessage('Niepawidłowe dane w oknie'+(Sender as TEdit).Name);
     (Sender as TEdit).Setfocus;
   end;
   On E: ERangeError  do
   begin
     ShowMessage('Przekroczony zakres typu w oknie'+ (sender as TEdit).Name);
  end;
end;

end;

end.
