unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    f: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Shape1: TShape;
    Shape2: TShape;
    Shape3: TShape;
    Shape4: TShape;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure KeyPressdlaEdit(Sender: TObject; var Key: Char);
    procedure Shape1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

//zmieniona zostala nazwa procedury z Edit1KeyPress na KeyPressdlaEdit
//nie kojarzy sie wtedy tylkio z Edit1
procedure TForm1.KeyPressdlaEdit(Sender: TObject; var Key: Char);
begin
  if (Sender is TEdit) then
    if not (Key in [#8,'0'..'9']) then Key:=#0;
end;


procedure TForm1.Shape1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (Sender is TShape) then
  begin
    (Sender as TShape).Brush.Color:=Random(9999999);
    (Sender as TShape).Shape:=TShapeType(Random(6));
  end;
end;

end.
