📄 acciinfofrm.pas
字号:
unit AcciInfoFrm;
{*******************************************
* brief: 设置词法文件的信息,可作为父窗体
* autor: linzhenqun
* date: 2005-11-01
* email: linzhengqun@163.com
* blog: http://blog.csdn.net/linzhengqun
* 功能简介:
* 录入词法配置文件名称与路径
* 词法名称不能是已存在
********************************************}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BaseFrm, StdCtrls, Buttons;
type
TFrmAcciInfo = class(TFrmBase)
lblName: TLabel;
edtName: TEdit;
lblFilePath: TLabel;
edtFilePath: TEdit;
btnOK: TButton;
btnCancel: TButton;
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
FAcciName: string;
FFilePath: string;
procedure SetFilePath(const Value: string);
procedure SetAcciName(const Value: string);
(* 检查输入的信息是否正确 *)
function CheckInfo: Boolean;
public
{ Public declarations }
procedure getLangRes;override;
property AcciName: string read FAcciName write SetAcciName;
property FilePath: string read FFilePath write SetFilePath;
end;
var
FrmAcciInfo: TFrmAcciInfo;
implementation
uses
CommonUtils, Config;
{$R *.dfm}
{ TFrmAcciInfo }
procedure TFrmAcciInfo.getLangRes;
begin
inherited;
Self.Caption := pubGet(212);
lblName.Caption := pubGet(213);
lblFilePath.Caption := pubGet(214);
btnOk.Caption := pubGet(5);
btnCancel.Caption := pubGet(6);
end;
procedure TFrmAcciInfo.SetFilePath(const Value: string);
begin
if FFilePath <> Value then
begin
FFilePath := Value;
edtFilePath.Text := Value;
end;
end;
procedure TFrmAcciInfo.SetAcciName(const Value: string);
begin
if FAcciName <> Value then
begin
FAcciName := Value;
edtName.Text := Value;
end;
end;
procedure TFrmAcciInfo.btnOKClick(Sender: TObject);
begin
inherited;
if CheckInfo then
begin
FAcciName := edtName.Text;
FFilePath := edtFilePath.Text;
ModalResult := mrOk;
end;
end;
function TFrmAcciInfo.CheckInfo: Boolean;
var
i: Integer;
begin
Result := True;
if edtName.Text = '' then
begin
MessageBox(Handle, PChar(pubGet('Err_NameEmpty')),
PChar(pubGet(1)), MB_OK+MB_ICONERROR);
edtName.SetFocus;
Result := False;
end
else if edtFilePath.Text = '' then
begin
MessageBox(Handle, PChar(pubGet('Err_FilePathEmpty')),
PChar(pubGet(1)), MB_OK+MB_ICONERROR);
edtFilePath.SetFocus;
Result := False;
end
else begin
//for i := 0 to gSourceToConfig.AcciCount - 1 do
// if gSourceToConfig.AcciItem[i]^.Name = edtName.Text then // 全部名称列表
if Pos(Trim(edtName.Text)+#13#10,gAppConfig.GetAccidenceFilesName)>0 then
begin
MessageBox(Handle, PChar(pubGet('Err_NameExist')),
PChar(pubGet(1)), MB_OK+MB_ICONERROR);
edtName.SetFocus;
Result := False;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -