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
else begin
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]
else
Result:=nil;

View File

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