mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 02:18:25 +02:00
anchordocking: fixed hiding docksite when last control gets Visible=false
git-svn-id: trunk@55482 -
This commit is contained in:
parent
bd57210a2f
commit
6c7ffd91e2
@ -272,6 +272,7 @@ type
|
|||||||
Inside: boolean): boolean; virtual;
|
Inside: boolean): boolean; virtual;
|
||||||
function DockAnotherControl(Sibling, NewControl: TControl; DockAlign: TAlign;
|
function DockAnotherControl(Sibling, NewControl: TControl; DockAlign: TAlign;
|
||||||
Inside: boolean): boolean; virtual;
|
Inside: boolean): boolean; virtual;
|
||||||
|
procedure ChildVisibleChanged(Sender: TObject); virtual;
|
||||||
procedure CreatePages; virtual;
|
procedure CreatePages; virtual;
|
||||||
procedure FreePages; virtual;
|
procedure FreePages; virtual;
|
||||||
function DockSecondPage(NewControl: TControl): boolean; virtual;
|
function DockSecondPage(NewControl: TControl): boolean; virtual;
|
||||||
@ -3379,6 +3380,31 @@ begin
|
|||||||
FHeaderSide:=AValue;
|
FHeaderSide:=AValue;
|
||||||
end;
|
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;
|
procedure TAnchorDockHostSite.Notification(AComponent: TComponent;
|
||||||
Operation: TOperation);
|
Operation: TOperation);
|
||||||
begin
|
begin
|
||||||
@ -4897,6 +4923,7 @@ begin
|
|||||||
//debugln(['TAnchorDockHostSite.RemoveControl ',DbgSName(Self),'=',Caption,' ',DbgSName(AControl)]);
|
//debugln(['TAnchorDockHostSite.RemoveControl ',DbgSName(Self),'=',Caption,' ',DbgSName(AControl)]);
|
||||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.RemoveControl'){$ENDIF};
|
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.RemoveControl'){$ENDIF};
|
||||||
try
|
try
|
||||||
|
AControl.RemoveHandlerOnVisibleChanged(@ChildVisibleChanged);
|
||||||
inherited RemoveControl(AControl);
|
inherited RemoveControl(AControl);
|
||||||
if not (csDestroying in ComponentState) then begin
|
if not (csDestroying in ComponentState) then begin
|
||||||
if (not ((AControl is TAnchorDockHeader)
|
if (not ((AControl is TAnchorDockHeader)
|
||||||
@ -4925,6 +4952,7 @@ begin
|
|||||||
or (AControl is TAnchorDockHeader))
|
or (AControl is TAnchorDockHeader))
|
||||||
then
|
then
|
||||||
UpdateDockCaption;
|
UpdateDockCaption;
|
||||||
|
AControl.AddHandlerOnVisibleChanged(@ChildVisibleChanged);
|
||||||
finally
|
finally
|
||||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.InsertControl'){$ENDIF};
|
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.InsertControl'){$ENDIF};
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user