unit DlgNewY;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, Mask, Matrices, MiscRoutines, Spin;

type
  TYMparams = class(TForm)
    LRepeats: TLabel;
    OkButton: TButton;
    CancelButton: TButton;
    ERepeats: TSpinEdit;
    Bevel1: TBevel;
    EY: TEdit;
    Label1: TLabel;
    procedure FormShow(Sender: TObject);
    procedure ERepeatsExit(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    function  Validate:Boolean;
    procedure Clean;
  public
  end;

var
  YMparams: TYMparams;

implementation

{$R *.DFM}

function TYMparams.Validate;
begin
  Result:=CheckSpinContens(ERepeats,'Количество повторений');
end;

procedure TYMparams.Clean;
begin
  ERepeats.Value:=ValidInteger(ERepeats);
end;

procedure TYMparams.FormShow(Sender: TObject);
begin
  FocusControl(ERepeats);
end;

procedure TYMparams.ERepeatsExit(Sender: TObject);
begin
  if(not CheckSpinContens(ERepeats,'Количество повторений')) then
    ActiveControl:=ERepeats;
end;

procedure TYMparams.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if(ChooseResult(Key,ModalResult)<>mrNone) then
    ModalResult:=ChooseResult(Key,ModalResult);
end;

procedure TYMparams.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose:=ValidateByResult(Validate,Clean,ModalResult);
end;

end.

