嘿嘿,老兄??你注册成功了?????除非你遇到鬼了!!!
我试过很多遍!我将属性编辑器的声明放在一个单独的单元里,源码如下:
unit PropertyEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, PlusDB, DsgnIntf,adoreg;
type
TPlusCollectionProperty = class(TClassProperty)
Public
procedure Edit; Override;
function GetAttributes: TPropertyAttributes; Override;
function GetEditorClass: TCollectionEditorClass; Virtual;
function GetColOptions: TColOptions; Virtual;
end;
TPlusParametersProperty = class(TPlusCollectionProperty)
Public
procedure Edit; Override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(TPlusParameters), TPlusQuery, 'Parameters', TPlusParametersProperty);
end;
{ TPlusParametersProperty }
procedure TPlusParametersProperty.Edit;
var
Parameters: TPlusParameters;
begin
try
Parameters := TPlusParameters(GetOrdValue);
if Parameters.Count = 0 then Parameters.Refresh;
except
{ Ignore any error when trying to refresh the params }
end;
inherited Edit;
end;
{ TCollectionProperty }
procedure TPlusCollectionProperty.Edit;
var
Obj: TPersistent;
begin
Obj := GetComponent(0);
while (Obj <> nil) and not (Obj is TComponent) do
Obj := TPersistentCracker(Obj).GetOwner;
ShowCollectionEditorClass(Designer, GetEditorClass,
TComponent(Obj), TCollection(GetOrdValue), GetName, GetColOptions);
end;
function TPlusCollectionProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog, paReadOnly];
end;
function TPlusCollectionProperty.GetColOptions: TColOptions;
begin
Result := TCollectionEditor;
end;
function TPlusCollectionProperty.GetEditorClass: TCollectionEditorClass;
begin
Result := [coAdd, coDelete, coMove];
end;
end.
根本通不过!!!报错说:
Error creating form:Ancestor for 'TToolbarDesignWindow' not found
还有adoreg.pas单元所引用的其它单元如:CustomModuleEditors等大部分单元
都找不到!!!!