文件名后缀为Reg
的文件是什么类型的文件?
例如,与dxPSTCLnk.pas
文件(来自DevExpress)一起,还有一个dxPSTCLnkReg.pas
文件。
(我正在尝试构建一个包含dxPSTCLnk.pas
文件的软件包,因为DevExpress不再提供我需要的软件包,而我只是想知道这个文件是关于什么的。)
您何时使用Reg
后缀?
答案 0 :(得分:2)
Reg
后缀是一种非标准但经常使用的方式,表示它是带有代码的文件,它只负责将类,文件格式,IDE服务和其他类型注册到IDE中。这些类可以是组件,操作,属性编辑器,图形,组件编辑器等。
如果将后缀添加到单个单元源文件中,则它会从该单个单元中注册类。将后缀添加到设计包源文件中时,它会注册该包中所有单元的所有类。
这样的注册单元通常只能在接口部分只有一个例程 - Register
- 来识别。
设计包注册单元的一个示例:
unit AwFrameworkReg;
interface
uses
Classes, ActnList, DesignIntf, ADOReg, DBReg, AwActions, AwStdCtrls,
AwDBCtrls, AwExtCtrls, AwSideBar, AwPlanGrid, AwComCtrls, AwPicture,
AwForms, AwControlMarking, AwDBClient, AwButtons, AwStringGrid,
AwImageGrid, AwFrameworkEdit, AwProvider, AwADODB, AwDxf, ToolsAPI,
AwToolsAPI, AwUtils;
procedure Register;
implementation
var
IdeNotifierIndex: Integer = -1;
procedure CreateIdeNotifier;
var
Services: IOTAServices;
begin
if IdeServicesAvailable then
begin
Services := GetServices;
IdeNotifierIndex := Services.AddNotifier(TAwIdeNotifier.Create);
end;
end;
procedure RegisterKeyboardBinding;
var
Services: IOTAKeyboardServices;
begin
if IdeServicesAvailable then
begin
Services := GetKeyboardServices;
Services.AddKeyboardBinding(TAwKeyboardBinding.Create);
end;
end;
procedure Register;
begin
{ AwStdCtrls }
RegisterComponents('Awerdo', [TAwEdit, TAwCombo, TAwFormatEdit, TAwListBox,
TAwCheckBox, TAwButton, TAwMemo, TAwGroupBox]);
{ AwExtCtrls }
RegisterComponents('Awerdo', [TAwProgressBar, TAwProgressStatusBar]);
{ AwDBCtrls }
RegisterComponents('Awerdo', [TAwDBEdit, TAwDBCombo, TAwDBSearchCombo,
TAwDBLookupCombo, TAwDBNavigator]);
RegisterPropertyEditor(TypeInfo(String), TAwDBEdit, 'DataField',
TDataFieldProperty);
RegisterPropertyEditor(TypeInfo(String), TAwDBCustomCombo, 'DataField',
TDataFieldProperty);
{ AwComCtrls }
RegisterComponents('Awerdo', [TAwTabSheet, TAwPageControl]);
{ Other }
RegisterComponents('Awerdo', [TAwSideBar, TAwPlanGrid, TAwPicture,
TAwDxfImage, TAwExtraMDIProps, TAwControlMarker, TAwClientDataSet,
TAwPngBitBtn, TAwPngDropDownBitBtn, TAwStringGrid, TAwImageGrid,
TAwProvider, TAwADOConnection, TAwADODataSet]);
RegisterActions('Form', [TFormOpen], nil);
RegisterComponentEditor(TAwStringGrid, TAwStringGridEditor);
RegisterPropertyEditor(TypeInfo(TPath), TAwImageGrid, 'Folder',
TPathProperty);
RegisterPropertyEditor(TypeInfo(String), TAwClientDataSet, 'CommandText',
TCommandTextProperty);
CreateIdeNotifier;
RegisterKeyboardBinding;
end;
procedure RemoveIdeNotifier;
var
Services: IOTAServices;
begin
if IdeNotifierIndex <> -1 then
begin
Services := GetServices;
Services.RemoveNotifier(IdeNotifierIndex);
end;
end;
initialization
finalization
RemoveIdeNotifier;
end.