IDE: changed GetLookupRootForComponent to handle nested/inline components

git-svn-id: trunk@15719 -
This commit is contained in:
mattias 2008-07-09 11:56:49 +00:00
parent 6e13c5dbe9
commit a694ca9ced
2 changed files with 7 additions and 16 deletions

View File

@ -1349,7 +1349,7 @@ begin
// child selection // child selection
end else begin end else begin
if (ssShift in Shift) then begin if (ssShift in Shift) then begin
// shift key pressed (multiselection) // shift key pressed (multiselection)
if CompIndex<0 then begin if CompIndex<0 then begin
// not selected // not selected

View File

@ -5498,24 +5498,14 @@ var
i: Integer; i: Integer;
Handler: TPropHookSetSelection; Handler: TPropHookSetSelection;
APersistent: TPersistent; APersistent: TPersistent;
AComponent: TComponent;
NewLookupRoot: TPersistent; NewLookupRoot: TPersistent;
begin begin
// update LookupRoot // update LookupRoot
NewLookupRoot:=LookupRoot; NewLookupRoot:=LookupRoot;
if (ASelection<>nil) and (ASelection.Count>0) then begin if (ASelection<>nil) and (ASelection.Count>0) then begin
APersistent:=ASelection[0]; APersistent:=ASelection[0];
if APersistent<>nil then begin if APersistent<>nil then
if (APersistent is TComponent) then begin NewLookupRoot:=GetLookupRootForComponent(APersistent);
AComponent:=TComponent(APersistent);
if AComponent.Owner<>nil then
NewLookupRoot:=AComponent.Owner
else
NewLookupRoot:=AComponent;
end else begin
NewLookupRoot:=APersistent;
end;
end;
end; end;
LookupRoot:=NewLookupRoot; LookupRoot:=NewLookupRoot;
// set selection // set selection
@ -6163,9 +6153,10 @@ var
function GetLookupRootForComponent(APersistent: TPersistent): TPersistent; function GetLookupRootForComponent(APersistent: TPersistent): TPersistent;
begin begin
Result:=APersistent; Result:=APersistent;
if (Result<>nil) and (Result is TComponent) if (Result<>nil) and (Result is TComponent) then begin
and (TComponent(Result).Owner<>nil) then while TComponent(Result).Owner<>nil do
Result:=TComponent(Result).Owner; Result:=TComponent(Result).Owner;
end;
end; end;
function GetClassUnitName(Value: TClass): string; function GetClassUnitName(Value: TClass): string;