mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 18:09:23 +02:00
anchordocking: fixed hiding docksite when last control gets Visible=false
git-svn-id: branches/fixes_1_8@55483 -
This commit is contained in:
parent
f144b91d8f
commit
3b529ee86e
@ -272,6 +272,7 @@ type
|
||||
Inside: boolean): boolean; virtual;
|
||||
function DockAnotherControl(Sibling, NewControl: TControl; DockAlign: TAlign;
|
||||
Inside: boolean): boolean; virtual;
|
||||
procedure ChildVisibleChanged(Sender: TObject); virtual;
|
||||
procedure CreatePages; virtual;
|
||||
procedure FreePages; virtual;
|
||||
function DockSecondPage(NewControl: TControl): boolean; virtual;
|
||||
@ -3378,6 +3379,31 @@ begin
|
||||
FHeaderSide:=AValue;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockHostSite.ChildVisibleChanged(Sender: TObject);
|
||||
var
|
||||
AControl: TControl;
|
||||
begin
|
||||
if Sender is TControl then begin
|
||||
AControl:=TControl(Sender);
|
||||
if not (csDestroying in ComponentState) then begin
|
||||
if (not AControl.Visible)
|
||||
and (not ((AControl is TAnchorDockHeader)
|
||||
or (AControl is TAnchorDockSplitter)
|
||||
or (AControl is TAnchorDockHostSite)))
|
||||
then begin
|
||||
//debugln(['TAnchorDockHostSite.ChildVisibleChanged START ',Caption,' ',dbgs(SiteType),' ',DbgSName(AControl),' UpdatingLayout=',UpdatingLayout]);
|
||||
if (SiteType=adhstOneControl) then
|
||||
Hide
|
||||
else if (SiteType=adhstLayout) then begin
|
||||
RemoveControlFromLayout(AControl);
|
||||
UpdateDockCaption;
|
||||
end;
|
||||
//debugln(['TAnchorDockHostSite.ChildVisibleChanged END ',Caption,' ',dbgs(SiteType),' ',DbgSName(AControl)]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockHostSite.Notification(AComponent: TComponent;
|
||||
Operation: TOperation);
|
||||
begin
|
||||
@ -4896,6 +4922,7 @@ begin
|
||||
//debugln(['TAnchorDockHostSite.RemoveControl ',DbgSName(Self),'=',Caption,' ',DbgSName(AControl)]);
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.RemoveControl'){$ENDIF};
|
||||
try
|
||||
AControl.RemoveHandlerOnVisibleChanged(@ChildVisibleChanged);
|
||||
inherited RemoveControl(AControl);
|
||||
if not (csDestroying in ComponentState) then begin
|
||||
if (not ((AControl is TAnchorDockHeader)
|
||||
@ -4924,6 +4951,7 @@ begin
|
||||
or (AControl is TAnchorDockHeader))
|
||||
then
|
||||
UpdateDockCaption;
|
||||
AControl.AddHandlerOnVisibleChanged(@ChildVisibleChanged);
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.InsertControl'){$ENDIF};
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user