📄 unitline.~pas
字号:
unit UnitLine;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TFormLine = class(TForm)
GroupBox: TGroupBox;
EditID: TEdit;
EditName: TEdit;
PanelID: TPanel;
PanelName: TPanel;
PanelBianDianZID: TPanel;
PanelMomo: TPanel;
EditMemo: TEdit;
BtnOK: TSpeedButton;
BtnCancel: TSpeedButton;
ComboBianDianZID: TComboBox;
PanelClass: TPanel;
EditClass: TEdit;
procedure btnOKClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
procedure CheckEditPressIsInteger(Sender: TObject; var Key: Char);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
iBtnClick : Integer;
end;
var
FormLine: TFormLine;
implementation
uses UnitBasic1;
{$R *.dfm}
procedure TFormLine.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 FormBasic1.ListView.Items.Count-1 do
begin
if ( StrToInt(EditID.Text) = StrToInt(FormBasic1.ListView.Items[i].Caption) )
and ( StrToInt(EditID.Text) <> StrToInt(FormBasic1.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 TFormLine.BtnCancelClick(Sender: TObject);
begin
iBtnClick := 0;
Self.Close();
end;
procedure TFormLine.CheckEditPressIsInteger(Sender: TObject; var Key: Char);
begin
{
if not (key in ['0'..'9','.']) then
Key := #0;
}
case Key of
'1':;
'2':;
'3':;
'4':;
'5':;
'6':;
'7':;
'8':;
'9':;
'0':;
else Key := #0;
end;
end;
procedure TFormLine.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 + -