📄 base.~pas
字号:
unit Base;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Mask, DBCtrls;
type
TfrmBase = class(TForm)
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
protected
iModuleID: Integer;
sFunctionName: string;
function IsTEdit(): Boolean; virtual;
public
constructor CreateWithFunction(AOwner: TComponent; ModuleID: Integer; FunctionName: string);
{ Public declarations }
end;
var
frmBase : TfrmBase;
implementation
uses Main, Global;
{$R *.dfm}
constructor TfrmBase.CreateWithFunction(AOwner: TComponent; ModuleID: Integer; FunctionName: string);
begin
iModuleID := ModuleID;
sFunctionName := FunctionName;
//ShowMessage(AOwner.ClassName);
inherited create(AOwner);
//ShowMessage(AOwner.ClassName);
end;
function TfrmBase.IsTEdit: Boolean; //是否是编辑框
begin
if (ActiveControl is TCustomEdit) or
(ActiveControl is TCustomComboBox) or
//(ActiveControl is TDxInplaceEdit) or
(ActiveControl is TDateTimePicker)
then
Result := True
else
Result := false;
end;
procedure TfrmBase.FormKeyPress(Sender: TObject; var Key: Char);
begin
//截获回车键,等效于Tab
if Key = #13 then
begin
if IsTEdit then
begin
Key := #0;
Perform(WM_NEXTDLGCTL, 0, 0);
end
{else if (ActiveControl is TDBGrid) then
with TDBGrid(ActiveControl) do
if selectedIndex < (FieldCount - 1) then
selectedIndex := selectedIndex + 1
else
selectedIndex := 0;
end;}
end;
end;
procedure TfrmBase.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//Close;
Action := cafree;
//frmBase := nil;
//frmBase:=nil;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -