unit WebNewTenderFrm;

interface

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

type
  TWebNewTenderForm = class(TForm)
    btnOK: TButton;
    btnCancel: TButton;
    lbl1: TLabel;
    edtKey: TEdit;
    lbl2: TLabel;
    edtTenderName: TEdit;
    lblHint: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure edtKeyKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure btnOKClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

uses ConstUnit;

{$R *.dfm}

procedure TWebNewTenderForm.FormCreate(Sender: TObject);
begin
  if G_IsTest then
  begin
    edtKey.Text := ''; // 本地
    edtTenderName.Text := '';
  end;
  lblHint.Caption := '';
  lblHint.Update;
end;

procedure TWebNewTenderForm.edtKeyKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = 13 then
    btnOK.Click;
end;

procedure TWebNewTenderForm.btnOKClick(Sender: TObject);
begin
  lblHint.Caption := '';
  lblHint.Update;

  if Trim(edtKey.Text) = '' then
  begin
    lblHint.Caption := 'KEY不能为空';
    lblHint.Update;
    edtKey.SetFocus;
    Exit;
  end;

  if Trim(edtTenderName.Text) = '' then
  begin
    lblHint.Caption := '标段名称不能为空';
    lblHint.Update;
    edtTenderName.SetFocus;
    Exit;
  end;

  ModalResult := mrOk;
end;

end.
