📄 common.pas
字号:
unit Common;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
const
NoUseKey = 0;
EnterKey = 13;
UPKey = 38;
DownKey = 40;
PageUpKey = 33;
PageDownKey = 34;
InsertKey = 45;
DeleteKey = 46;
Key_F1 = 112;
Key_ESC = 27;
PlusKey = 107;
cNoUseKey = #0;
cEnterKey = #13;
cUPKey = #38;
cDownKey = #40;
cPageUpKey = #33;
cPageDownKey = #34;
cPlusKey = '+';
//Color Define
EnterColor = $00ECFFFF;
DefaultColor = clWindow;
UnIssureKindCode = '00';
UnIssureKind = '非参保';
IssurePayCode = '00';
IssurePay = '医保支付';
msgSaveError = '数据保存错误!';
msgSaveOK = '数据保存成功!';
type
TActiveButton = (abNormal, abOK, abCancel, abNo);
TCurrentAction = ( caAdd, caEdit, caBrowse );
TCommon = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent);override;
procedure ShowHint(Str: String);
procedure ShowWarning(Str: String);
function ShowQuestion(Str: String; ActiveButton: TActiveButton = abCancel): TModalResult;
procedure ShowError(Str: String);
function ShowCancel(ActiveButton: TActiveButton = abCancel): TModalResult;
function ShowSave(ActiveButton: TActiveButton = abOK):TModalResult;
procedure ShowSaveOK;
procedure ShowSaveError;
function ShowClose(Sender:TObject): TModalResult;
function ShowCloseSave: TModalResult;
published
{ Published declarations }
end;
procedure Register;
implementation
uses InformationForm;
procedure Register;
begin
RegisterComponents('医疗保险', [TCommon]);
end;
constructor TCommon.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
frmInformation := TfrmInformation.create(Application);
end;
function TCommon.ShowCancel(ActiveButton: TActiveButton): TModalResult;
begin
Result := ShowQuestion('是否取消编辑数据?', ActiveButton)
end;
function TCommon.ShowClose(Sender:TObject): TModalResult;
begin
Result := ShowQuestion('是否退出' + TForm(Sender).Caption + '?')
end;
function TCommon.ShowCloseSave: TModalResult;
begin
Result := ShowQuestion('数据未保存,是否退出?');
end;
procedure TCommon.ShowError(Str: String);
begin
frmInformation.Caption := Application.MainForm.Caption;;
frmInformation.ShowError(Str);
end;
procedure TCommon.ShowHint(Str: String);
begin
frmInformation.Caption := Application.MainForm.Caption;;
frmInformation.ShowHint(Str);
end;
function TCommon.ShowQuestion(Str: String; ActiveButton: TActiveButton): TModalResult;
begin
frmInformation.Caption := Application.MainForm.Caption;;
frmInformation.ActiveButton := ActiveButton;
Result := frmInformation.ShowQuestion(Str);
end;
function TCommon.ShowSave(ActiveButton: TActiveButton): TModalResult;
begin
Result := ShowQuestion('是否保存数据?', ActiveButton)
end;
procedure TCommon.ShowSaveOK;
begin
ShowHint(msgSaveOK);
end;
procedure TCommon.ShowSaveError;
begin
ShowError(msgSaveError);
end;
procedure TCommon.ShowWarning(Str: String);
begin
frmInformation.Caption := Application.MainForm.Caption;
frmInformation.ShowWarning(Str);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -