From fa0454afe21f2152cf806db2c7b3dc7d36b3eed0 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 26 Nov 2010 14:51:43 +0000 Subject: [PATCH] * Fixed references to sub components (mantis #18021) git-svn-id: trunk@16448 - --- rtl/objpas/classes/writer.inc | 37 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/rtl/objpas/classes/writer.inc b/rtl/objpas/classes/writer.inc index 5d728cc408..0688f8765f 100644 --- a/rtl/objpas/classes/writer.inc +++ b/rtl/objpas/classes/writer.inc @@ -859,7 +859,7 @@ var StrValue, DefStrValue: String; UStrValue, UDefStrValue: UnicodeString; AncestorObj: TObject; - Component: TComponent; + C,Component: TComponent; ObjValue: TObject; SavedAncestor: TPersistent; SavedPropPath, Name: String; @@ -1080,19 +1080,28 @@ begin if (ObjValue <> AncestorObj) and not (csTransient in Component.ComponentStyle) then begin - { Determine the correct name of the component this property contains } - if Component.Owner = LookupRoot then - Name := Component.Name - else if Component = LookupRoot then - Name := 'Owner' - else if Assigned(Component.Owner) and (Length(Component.Owner.Name) > 0) - and (Length(Component.Name) > 0) then - Name := Component.Owner.Name + '.' + Component.Name - else if Length(Component.Name) > 0 then - Name := Component.Name + '.Owner' - else - SetLength(Name, 0); - + Name:= ''; + C:= Component; + While (C<>Nil) and (C.Name<>'') do + begin + If (Name<>'') Then + Name:='.'+Name; + if C.Owner = LookupRoot then + begin + Name := C.Name+Name; + break; + end + else if C = LookupRoot then + begin + Name := 'Owner' + Name; + break; + end; + Name:=C.Name + Name; + C:= C.Owner; + end; + if (C=nil) and (Component.Owner=nil) then + if (Name<>'') then //foreign root + Name:=Name+'.Owner'; if Length(Name) > 0 then begin Driver.BeginProperty(FPropPath + PPropInfo(PropInfo)^.Name);