logicselectedfrm.pas

来自「这个是个简单的关于出票申请的处理」· PAS 代码 · 共 60 行

PAS
60
字号
unit logicSelectedFrm;

interface

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

type
  TFormSelectLogic = class(TForm)
    Panel2: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Panel1: TPanel;
    Label1: TLabel;
    cbLogic: TComboBox;
    EdtCount: TEdit;
    procedure EdtCountKeyPress(Sender: TObject; var Key: Char);
    procedure EdtCountChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    class function ShowSelectLogic(var sLogic: string): Boolean;
  end;

implementation

{$R *.dfm}

procedure TFormSelectLogic.EdtCountKeyPress(Sender: TObject;
  var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then Key := #0;
end;

class function TFormSelectLogic.ShowSelectLogic(
  var sLogic: string): Boolean;
begin
  Result := False;
  with TFormSelectLogic.Create(nil) do
  try
    cbLogic.ItemIndex := 0;
    EdtCount.Text := '0';
    if ShowModal = MROK then
    begin
      Result := True;
      sLogic := cbLogic.Text + EdtCount.Text;
    end;
  finally
  end;
end;

procedure TFormSelectLogic.EdtCountChange(Sender: TObject);
begin
  if Trim(EdtCount.Text) = '' then EdtCount.Text := '0';
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?