mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 15:59:15 +02:00
Merged revision(s) 60206 #3d405210f9 from trunk:
AnchorDocking: Fixed SimplifyOneControl destroy the layout, Issue #34937 ........ git-svn-id: branches/fixes_2_0@60221 -
This commit is contained in:
parent
4fcdffe2a9
commit
64941cd4a8
@ -4516,7 +4516,7 @@ procedure TAnchorDockHostSite.SimplifyOneControl;
|
|||||||
var
|
var
|
||||||
Site: TAnchorDockHostSite;
|
Site: TAnchorDockHostSite;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
Child: TControl;
|
Child, PlaceHolder: TControl;
|
||||||
a: TAnchorKind;
|
a: TAnchorKind;
|
||||||
begin
|
begin
|
||||||
if SiteType<>adhstOneControl then exit;
|
if SiteType<>adhstOneControl then exit;
|
||||||
@ -4538,11 +4538,22 @@ begin
|
|||||||
|
|
||||||
Site.BeginUpdateLayout;
|
Site.BeginUpdateLayout;
|
||||||
// move controls from Site to Self
|
// move controls from Site to Self
|
||||||
|
// when a site is moved to a other parent, we have to insert a place holder
|
||||||
|
// on old site or the splitters will be removed, see issue #34937
|
||||||
i:=Site.ControlCount-1;
|
i:=Site.ControlCount-1;
|
||||||
while i>=0 do begin
|
while i>=0 do begin
|
||||||
Child:=Site.Controls[i];
|
Child:=Site.Controls[i];
|
||||||
if Child.Owner<>Site then begin
|
if (Child.Owner<>Site) then begin
|
||||||
//debugln(['TAnchorDockHostSite.SimplifyOneControl Self="',Caption,'" Child=',DbgSName(Child),'="',Child.Caption,'"']);
|
if not (Child is TAnchorDockSplitter) then begin
|
||||||
|
PlaceHolder:=TAnchorDockHostSite.CreateNew(Site);
|
||||||
|
PlaceHolder.Parent:=Site;
|
||||||
|
PlaceHolder.Anchors:=Child.Anchors;
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
||||||
|
PlaceHolder.AnchorSide[a].Control:=Child.AnchorSide[a].Control;
|
||||||
|
PlaceHolder.SetBounds(Child.Left, Child.Top, Child.Width, Child.Height);
|
||||||
|
PlaceHolder.Name:='_'+Child.Name;
|
||||||
|
PlaceHolder.Visible:=Child.Visible;
|
||||||
|
end;
|
||||||
Child.Parent:=Self;
|
Child.Parent:=Self;
|
||||||
if Child=Site.Pages then begin
|
if Child=Site.Pages then begin
|
||||||
FPages:=Site.Pages;
|
FPages:=Site.Pages;
|
||||||
@ -4557,6 +4568,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
i:=Min(i,Site.ControlCount)-1;
|
i:=Min(i,Site.ControlCount)-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
for i:=0 to ControlCount-1 do begin
|
||||||
|
Child:=Controls[i];
|
||||||
|
PlaceHolder:=TControl(Site.FindComponent('_'+Child.Name));
|
||||||
|
if not Assigned(PlaceHolder) then continue;
|
||||||
|
for a:=Low(TAnchorKind) to High(TAnchorKind) do
|
||||||
|
if PlaceHolder.AnchorSide[a].Control<>Site then
|
||||||
|
Child.AnchorSide[a].Control:=PlaceHolder.AnchorSide[a].Control;
|
||||||
|
end;
|
||||||
Site.EndUpdateLayout;
|
Site.EndUpdateLayout;
|
||||||
|
|
||||||
// delete Site
|
// delete Site
|
||||||
|
Loading…
Reference in New Issue
Block a user