AnchorDocking: also update header caption when pages are inserted and removed, issue #36008

This commit is contained in:
Maxim Ganetsky 2023-04-28 17:44:55 +03:00
parent e13a030d63
commit 8debfce05d

View File

@ -324,6 +324,7 @@ type
constructor Create(TheOwner: TComponent); override;
procedure UpdateDockCaption(Exclude: TControl = nil); override;
property DockPages[Index: integer]: TAnchorDockPage read GetDockPages;
procedure InsertControl(AControl: TControl; Index: Integer); override;
procedure RemoveControl(AControl: TControl); override;
function GetActiveSite: TAnchorDockHostSite;
end;
@ -8100,12 +8101,19 @@ begin
TAnchorDockPage(Parent).UpdateDockCaption;
end;
procedure TAnchorDockPageControl.InsertControl(AControl: TControl; Index: Integer);
begin
inherited InsertControl(AControl, Index);
UpdateDockCaption;
end;
procedure TAnchorDockPageControl.RemoveControl(AControl: TControl);
begin
inherited RemoveControl(AControl);
if (not (csDestroying in ComponentState)) then begin
if (PageCount<=1) and (Parent is TAnchorDockHostSite) then
DockMaster.NeedSimplify(Parent);
UpdateDockCaption;
end;
end;