unit Unit7;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids, DBGrids, StdCtrls, Mask, DBCtrls, Buttons;

type
  Tinit = class(TForm)
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public

    { Public declarations }
  end;

var
  init: Tinit;
  cod_elev:integer;
implementation

uses Unit1, Unit3;

{$R *.DFM}

procedure Tinit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
mainform.enabled:=true;
end;

procedure Tinit.FormShow(Sender: TObject);
begin
dm.elevi.Append;
end;

procedure Tinit.Button1Click(Sender: TObject);
begin
dm.elevi['data']:=date();
dm.elevi['ora']:=time();
dm.elevi.Post;
cod_elev:=dm.elevi['cod'];
init.close;
end;

procedure Tinit.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then dbedit2.SetFocus;

end;

procedure Tinit.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then button1.SetFocus;
end;

end.
