designer: fix getting offsets of non-visual ancestor components

git-svn-id: trunk@22817 -
This commit is contained in:
paul 2009-11-27 04:10:25 +00:00
parent 0d4b165835
commit 3a13c17161

View File

@ -142,10 +142,13 @@ begin
ParentForm := GetDesignerForm(Component);
Result.X := LeftFromDesignInfo(Component.DesignInfo);
Result.Y := TopFromDesignInfo(Component.DesignInfo);
while Component.Owner <> ParentForm do
while (Component <> nil) and (Component.Owner <> ParentForm) do
begin
Component := Component.Owner;
if Component is TControl then
if Component = nil then
break;
if (csInline in Component.ComponentState) and
(Component is TControl) then
begin
inc(Result.X, TControl(Component).Left);
inc(Result.Y, TControl(Component).Top);
@ -215,10 +218,13 @@ begin
ParentForm := GetDesignerForm(Component);
if ParentForm = nil then
Exit;
while Component.Owner <> ParentForm do
while (Component <> nil) and (Component.Owner <> ParentForm) do
begin
Component := Component.Owner;
if Component is TControl then
if Component = nil then
break;
if (csInline in Component.ComponentState) and
(Component is TControl) then
begin
inc(Result.X, TControl(Component).Left);
inc(Result.Y, TControl(Component).Top);