📄 unitbiandianz.pas
字号:
unit UnitBianDianZ;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TFormBianDianZ = class(TForm)
BtnOK: TSpeedButton;
BtnCancel: TSpeedButton;
GroupBox: TGroupBox;
EditID: TEdit;
EditName: TEdit;
PanelID: TPanel;
PanelName: TPanel;
PanelMomo: TPanel;
EditMemo: TEdit;
procedure CheckEditPressIsInteger(Sender: TObject; var Key: Char);
procedure BtnOKClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
iBtnClick : Integer;
end;
var
FormBianDianZ: TFormBianDianZ;
implementation
uses UnitBasic0;
{$R *.dfm}
procedure TFormBianDianZ.BtnOKClick(Sender: TObject);
var
bInputOK : boolean;
i : Integer;
begin
bInputOK := True;
if EditID.Text = '' then
begin
MessageBox(self.Handle, '【变电站序号】不能为空', '录入错误', MB_ICONSTOP);
bInputOK := False;
end //if
else
begin
for i:=0 to FormBasic0.ListView.Items.Count-1 do
begin
if ( StrToInt(EditID.Text) = StrToInt(FormBasic0.ListView.Items[i].Caption) )
and ( StrToInt(EditID.Text) <> StrToInt(FormBasic0.ListView.Selected.Caption) ) then
begin
MessageBox(self.Handle, '【变电站序号】不能重复', '录入错误', MB_ICONSTOP);
bInputOK := False;
break;
end; //if (=)
end; //for (i)
end; //else
if bInputOK = true then
begin
if EditName.Text = '' then
begin
MessageBox(self.Handle, '【变电站名称】不能为空', '录入错误', MB_ICONSTOP);
bInputOK := False;
end; //if
end;
if bInputOK = true then
begin
iBtnClick := 1;
Self.Close();
end; //if
end;
procedure TFormBianDianZ.BtnCancelClick(Sender: TObject);
begin
iBtnClick := 0;
Self.Close();
end;
procedure TFormBianDianZ.CheckEditPressIsInteger(Sender: TObject; var Key: Char);
begin
{
if not (key in ['0'..'9','.']) then
Key := #0;
}
if not (Key in ['0'..'9', char(08)] ) then
begin
Key := #0;
end;
end;
procedure TFormBianDianZ.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
BtnOKClick(Sender);
if Key = #27 then
BtnCancelClick(Sender);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -