📄 searchport.pas
字号:
unit SearchPort;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Mask;
type
TdlgSearchPort = class(TForm)
Label1: TLabel;
cbPort: TComboBox;
cbRate: TComboBox;
Label2: TLabel;
btnOK: TButton;
btnCancel: TButton;
edStartClockID: TMaskEdit;
Label3: TLabel;
edEndClockID: TMaskEdit;
Label4: TLabel;
edDelay: TComboBox;
Label5: TLabel;
Label6: TLabel;
cbTestAllPort: TCheckBox;
Label7: TLabel;
cbCmdVerify: TCheckBox;
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure edDelayExit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function Execute(var Port, BaudRate, start_id, end_id, Delay: Integer;var AllPort: Boolean): Boolean;
end;
var
dlgSearchPort: TdlgSearchPort;
implementation
uses Main;
{$R *.DFM}
function TdlgSearchPort.Execute(var Port, BaudRate, start_id, end_id, Delay: Integer;var AllPort: Boolean): Boolean;
begin
if not Assigned(dlgSearchPort) then dlgSearchPort:=TdlgSearchPort.Create(Application);
with dlgSearchPort do
begin
Result:=ShowModal=mrOK;
if Result then
begin
Port:=StrToIntDef(Copy(cbPort.Text, 4, Length(cbPort.Text)-3), 1);
BaudRate:=StrToIntDef(cbRate.Text, 9600);
Start_id:=StrToIntDef('$'+edStartClockID.Text, 0);
End_id:=StrToIntDef('$'+edEndClockID.Text, 0);
Delay:=StrToIntDef(Trim(edDelay.Text), 100);
AllPort:=cbTestAllPort.Checked;
end;
end;
end;
procedure TdlgSearchPort.FormDestroy(Sender: TObject);
begin
dlgSearchPort:=nil;
end;
procedure TdlgSearchPort.FormCreate(Sender: TObject);
begin
cbPort.Items.Text:=CommPorts;
end;
procedure TdlgSearchPort.edDelayExit(Sender: TObject);
begin
try
StrToInt(edDelay.Text);
except
if edDelay.Canfocus then edDelay.SetFocus;
Raise;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -