documentstypef.pas
来自「极具实用价值的文件管理系统」· PAS 代码 · 共 94 行
PAS
94 行
{ *********************************************************************** }
{ Unit Name: DocumentsTypeF
{ Purpose: DocumentsTypeF
{ Author: Cyclone
{ History:
{ 2004-6-7 22:28:55 Create the function
{ *********************************************************************** }
unit DocumentsTypeF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BaseF, WinSkinData, Buttons, CycSpeedButton, CycPanel, StdCtrls,
DBCtrls, CycLabeledDBMemo, Mask, CycLabeledDBEdit, DialogBaseF, ExtCtrls,
CycLabel;
type
TfmDocumentsType = class(TfmDialogBase)
edtTypeCode: TCycLabeledDBEdit;
edtTypeName: TCycLabeledDBEdit;
edtRemarks: TCycLabeledDBMemo;
procedure FormActivate(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
ParentCategoryCode: String;
end;
var
fmDocumentsType: TfmDocumentsType;
implementation
uses MainD, PubFuns;
{$R *.dfm}
procedure TfmDocumentsType.FormActivate(Sender: TObject);
begin
inherited;
if OperType = otInsert then
begin
dmMain.dsCategory.Append;
dmMain.dsCategory.FieldByName('ParentTypeCode').AsString := ParentCategoryCode;
edtTypeCode.ReadOnly := False;
edtTypeCode.SetFocus;
end
else
begin
dmMain.dsCategory.Edit;
edtTypeCode.ReadOnly := True;
edtTypeName.SetFocus;
end;
end;
procedure TfmDocumentsType.btnCancelClick(Sender: TObject);
begin
if IsDataSetInEdit(dmMain.dsCategory) then
begin
dmMain.dsCategory.Cancel;
end;
dmMain.dsCategory.CancelBatch;
inherited;
end;
procedure TfmDocumentsType.btnOKClick(Sender: TObject);
begin
if Trim(edtTypeCode.Text) = '' then
begin
ShowError('Category code cannot be empty!');
edtTypeCode.SetFocus;
Exit;
end;
if Trim(edtTypeName.Text) = '' then
begin
ShowError('Category name cannot be empty!');
edtTypeName.SetFocus;
Exit;
end;
if IsDataSetInEdit(dmMain.dsCategory) then
begin
dmMain.dsCategory.Post;
end;
dmMain.dsCategory.UpdateBatch;
inherited;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?