unit U_PageHeight;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxLookAndFeelPainters, StdCtrls, cxButtons, cxControls,
  cxContainer, cxEdit, cxTextEdit, cxMaskEdit;

type
  TF_PageHeight = class(TForm)
    bOK: TcxButton;
    bCancel: TcxButton;
    edPageHeight: TcxMaskEdit;
    procedure bCancelClick(Sender: TObject);
    procedure bOKClick(Sender: TObject);
    procedure edPageHeightKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure edPageHeightExit(Sender: TObject);
  private
    { Private declarations }
  public
    CurrentPageHeight: string;
    { Public declarations }
  end;

var
  F_PageHeight: TF_PageHeight;

implementation
uses USCS_Main, U_CAD, U_Common;
{$R *.dfm}

procedure TF_PageHeight.bCancelClick(Sender: TObject);
begin
  Close;
end;

procedure TF_PageHeight.bOKClick(Sender: TObject);
begin
  try
    GCadForm.PCad.Height := StrToInt(edPageHeight.Text);
  except
    ShowMessage('EXCEPTION: TF_PageHeight.bOKClick');
  end;
end;

procedure TF_PageHeight.edPageHeightKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    bOK.SetFocus;
    bOK.Click;
  end;
end;

procedure TF_PageHeight.FormShow(Sender: TObject);
begin
  edPageHeight.Text := IntToStr(GCadForm.PCad.Height);
  CurrentPageHeight := edPageHeight.Text;
  edPageHeight.SetFocus;
end;


procedure TF_PageHeight.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #27 then
    Close;
end;

procedure TF_PageHeight.edPageHeightExit(Sender: TObject);
begin
  if edPageHeight.Text = '' then
    edPageHeight.Text := CurrentPageHeight;
end;

end.
