mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 07:09:18 +02:00
lcl: reset parent orientation if we remove control and parent stay only with 1 child (fixes crash in insertcontrol)
git-svn-id: trunk@17865 -
This commit is contained in:
parent
4620b0c84b
commit
3817032fa7
@ -1220,12 +1220,16 @@ procedure TLazDockTree.InsertControl(AControl: TControl; InsertAt: TAlign;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
DropZone, OldParentZone, NewParentZone: TDockZone;
|
CtlZone, DropZone, OldParentZone, NewParentZone: TDockZone;
|
||||||
NewZone: TLazDockZone;
|
NewZone: TLazDockZone;
|
||||||
NewOrientation: TDockOrientation;
|
NewOrientation: TDockOrientation;
|
||||||
NeedNewParentZone: Boolean;
|
NeedNewParentZone: Boolean;
|
||||||
NewBounds: TRect;
|
NewBounds: TRect;
|
||||||
begin
|
begin
|
||||||
|
CtlZone := RootZone.FindZone(AControl);
|
||||||
|
if CtlZone <> nil then
|
||||||
|
RemoveControl(AControl);
|
||||||
|
|
||||||
if (DropControl = nil) or (DropControl = AControl) then
|
if (DropControl = nil) or (DropControl = AControl) then
|
||||||
DropControl := DockSite;
|
DropControl := DockSite;
|
||||||
|
|
||||||
@ -1359,6 +1363,10 @@ begin
|
|||||||
RemoveZone := ParentZone;
|
RemoveZone := ParentZone;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// reset orientation
|
||||||
|
if (RemoveZone.ChildCount = 1) and (RemoveZone.Orientation in [doHorizontal, doVertical]) then
|
||||||
|
RemoveZone.Orientation := doNoOrient;
|
||||||
|
|
||||||
// Build dock layout (anchors, splitters, pages)
|
// Build dock layout (anchors, splitters, pages)
|
||||||
if (RemoveZone.Parent <> nil) then
|
if (RemoveZone.Parent <> nil) then
|
||||||
BuildDockLayout(RemoveZone.Parent as TLazDockZone)
|
BuildDockLayout(RemoveZone.Parent as TLazDockZone)
|
||||||
|
Loading…
Reference in New Issue
Block a user