Allow to use any class with RTTI for RunTimeTypeInfoControls (previously only using descendants of TPersistent was legal). Now is possible to use any ORM system with RTTI controls like mORMot. From Maciej.

git-svn-id: trunk@51089 -
This commit is contained in:
juha 2015-12-31 09:07:46 +00:00
parent c93f1b0a8b
commit f4b38428a6
2 changed files with 5 additions and 3 deletions

View File

@ -2164,7 +2164,8 @@ begin
Result:=C^.EditorClass Result:=C^.EditorClass
else begin else begin
if (PropType^.Kind<>tkClass) if (PropType^.Kind<>tkClass)
or (GetTypeData(PropType)^.ClassType.InheritsFrom(TPersistent)) then or (GetTypeData(PropType)^.ClassType.InheritsFrom(TPersistent))
or (GetTypeData(PropType)^.PropCount > 0) then
Result:=PropClassMap[PropType^.Kind] Result:=PropClassMap[PropType^.Kind]
else else
Result:=nil; Result:=nil;

View File

@ -91,13 +91,14 @@ var
function GetLookupRootForComponent(APersistent: TPersistent): TPersistent; function GetLookupRootForComponent(APersistent: TPersistent): TPersistent;
var var
AOwner: TPersistent; AOwner: TPersistent = nil;
i: Integer; i: Integer;
begin begin
Result := APersistent; Result := APersistent;
if Result = nil then if Result = nil then
Exit; Exit;
repeat repeat
if Result is TPersistent then
AOwner := TPersistentAccess(Result).GetOwner; AOwner := TPersistentAccess(Result).GetOwner;
if (AOwner=nil) and (GetLookupRoots<>nil) then begin if (AOwner=nil) and (GetLookupRoots<>nil) then begin
for i:=GetLookupRoots.Count-1 downto 0 do begin for i:=GetLookupRoots.Count-1 downto 0 do begin