From c4aef17fa937c2d3e7de0d54f5fdb8d5cc22d6e8 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 13 Mar 2006 22:35:50 +0000 Subject: [PATCH] implemented FindDeclarationOfOIProperty path for child components git-svn-id: trunk@8936 - --- components/codetools/finddeclarationtool.pas | 6 +++--- designer/objinspext.pas | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 66e17e9b47..2229cbef5e 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -1387,7 +1387,7 @@ var Context: TFindContext; begin Result:=false; - //DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath PropertyPath="',PropertyPath,'"'); + DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath PropertyPath="',PropertyPath,'"'); if PropertyPath='' then exit; BuildTree(false); @@ -1404,13 +1404,13 @@ begin try // then search the properties repeat - //DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath ',Context.Node.DescAsString); + DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath ',Context.Node.DescAsString); if (not (Context.Node.Desc in [ctnClass,ctnClassInterface,ctnRecordType])) then exit; Params.Flags:=[fdfExceptionOnNotFound,fdfSearchInAncestors]; Identifier:=GetNextIdentifier; - //DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath Identifier="',identifier,'"'); + DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath Identifier="',identifier,'"'); if Identifier='' then exit; Params.SetIdentifier(Self,PChar(Identifier),nil); Params.ContextNode:=Context.Node; diff --git a/designer/objinspext.pas b/designer/objinspext.pas index 2b25739a99..f72ed2cadc 100644 --- a/designer/objinspext.pas +++ b/designer/objinspext.pas @@ -199,6 +199,7 @@ var AFile: TLazProjectFile; NewCode: TCodeBuffer; NewX, NewY: integer; + APersistent: TPersistent; begin Result:=false; Code:=nil; @@ -236,9 +237,20 @@ begin if LoadCodeBuffer(Code,AFile.Filename,[])<>mrOk then begin exit; end; + if Row.Editor=nil then begin + DebugLn('FindDeclarationOfOIProperty Row.Editor=nil'); + exit; + end; // create the property search path - PropPath:=LookupRoot.ClassName+'.'+ - AnInspector.GetActivePropertyGrid.PropertyPath(Row); + APersistent:=Row.Editor.GetComponent(0); + if APersistent=nil then begin + DebugLn('FindDeclarationOfOIProperty APersistent=nil'); + exit; + end; + PropPath:=AnInspector.GetActivePropertyGrid.PropertyPath(Row); + if APersistent is TComponent then + PropPath:=TComponent(APersistent).Name+'.'+PropPath; + PropPath:=LookupRoot.ClassName+'.'+PropPath; // find the property declaration if not CodeToolBoss.FindDeclarationOfPropertyPath(Code,PropPath,NewCode, NewX,NewY,NewTopLine) then