⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchintfrm.pas

📁 === === === MiniHex 1.61 源程序说明 ============================== “$(MiniHex)Source”目录中的所有
💻 PAS
字号:
unit SearchIntFrm;

interface

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

type
  TSearchIntData = record
    Value: Int64;
    AllDoc: Boolean;
    Opt: TSearchIntOptions;
  end;

  TSearchIntForm = class(TForm)
    Label1: TLabel;
    GroupBox2: TGroupBox;
    OnlyBlockCheckBox: TCheckBox;
    AllDocCheckBox: TCheckBox;
    SearchButton: TButton;
    CancelButton: TButton;
    HelpButton: TButton;
    DefaultButton: TButton;
    ValueComboBox: TComboBox;
    TypeRadioGroup: TRadioGroup;
    procedure SearchButtonClick(Sender: TObject);
    procedure CancelButtonClick(Sender: TObject);
    procedure HelpButtonClick(Sender: TObject);
    procedure DefaultButtonClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
    function CheckValid: Boolean;

  public
    { Public declarations }
    procedure GetData(var Value: TSearchIntData);

  end;

var
  SearchIntForm: TSearchIntForm;

function ShowSearchIntForm(var Value: TSearchIntData): Boolean;

implementation

uses Misc, NumBase;

{$R *.DFM}

function ShowSearchIntForm(var Value: TSearchIntData): Boolean;
begin
  Result := (SearchIntForm.ShowModal = mrOk);
  if Result then SearchIntForm.GetData(Value);
end;

procedure TSearchIntForm.GetData(var Value: TSearchIntData);
begin
  Value.Value := StrToInt64Def(ValueComboBox.Text, 0);
  Value.AllDoc := AllDocCheckBox.Checked;
  Value.Opt.OnlyBlock := OnlyBlockCheckBox.Checked;
  case TypeRadioGroup.ItemIndex of
    0:  Value.Opt.IntegerType := itByte;
    1:  Value.Opt.IntegerType := itShortInt;
    2:  Value.Opt.IntegerType := itWord;
    3:  Value.Opt.IntegerType := itSmallInt;
    4:  Value.Opt.IntegerType := itLongWord;
    5:  Value.Opt.IntegerType := itLongInt;
    6:  Value.Opt.IntegerType := itInt64;
  end;
end;

function TSearchIntForm.CheckValid: Boolean;
begin
  Result := True;
  if ValueComboBox.Text = '' then
  begin
    Result := False;
    ValueComboBox.SetFocus;
    Exit;
  end;
  if not IsDecStr(ValueComboBox.Text) then
  begin
    Result := False;
    MsgBox('整型值不正确。');
    ValueComboBox.SetFocus;
    Exit;
  end;
end;

procedure TSearchIntForm.SearchButtonClick(Sender: TObject);
begin
  if CheckValid then
  begin
    ValueComboBox.Items.Insert(0, ValueComboBox.Text);
    ModalResult := mrOk;
  end;
end;

procedure TSearchIntForm.CancelButtonClick(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TSearchIntForm.HelpButtonClick(Sender: TObject);
begin
//
end;

procedure TSearchIntForm.DefaultButtonClick(Sender: TObject);
begin
  ValueComboBox.Text := '';
  TypeRadioGroup.ItemIndex := 0;
  OnlyBlockCheckBox.Checked := False;
  AllDocCheckBox.Checked := False;
end;

procedure TSearchIntForm.FormActivate(Sender: TObject);
begin
  ValueComboBox.SetFocus;
end;

end.

⌨️ 快捷键说明

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