?? acciinfofrm.pas
字號(hào):
unit AcciInfoFrm;
{*******************************************
* brief: 設(shè)置詞法文件的信息,可作為父窗體
* autor: linzhenqun
* date: 2005-11-01
* email: linzhengqun@163.com
* blog: http://blog.csdn.net/linzhengqun
* 功能簡(jiǎn)介:
* 錄入詞法配置文件名稱與路徑
* 詞法名稱不能是已存在
********************************************}
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.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -