mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-23 18:01:36 +02:00
dockmanager example: made invisible controls dockable, they will become visible afterwards.
git-svn-id: trunk@24833 -
This commit is contained in:
parent
c720ac78ac
commit
39b5335283
@ -393,6 +393,7 @@ end;
|
||||
procedure NoteBookAdd(ABook: TCustomDockSite; AItem: TControl);
|
||||
begin
|
||||
AItem.ManualDock(ABook);
|
||||
AItem.Visible := True;
|
||||
end;
|
||||
|
||||
function TryRename(AComp: TComponent; const NewName: string): boolean;
|
||||
@ -635,7 +636,9 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
//some checks
|
||||
if (Control = nil) or (not Control.Visible) or (DropCtl = Control) then begin
|
||||
if (Control = nil)
|
||||
//or (not Control.Visible)
|
||||
or (DropCtl = Control) then begin
|
||||
//bug? The dock site is changed when a control is dropped onto itself!?
|
||||
DebugLn('Redock-----');
|
||||
exit; //nothing changed
|
||||
@ -704,8 +707,8 @@ begin
|
||||
NewZone := TEasyZone.Create(self);
|
||||
NewZone.ChildControl := Control as TControl;
|
||||
Control.Align := alNone;
|
||||
if Control is TCustomForm then
|
||||
TCustomForm(Control).BorderStyle := bsNone;
|
||||
//is this still required?
|
||||
//if Control is TCustomForm then TCustomForm(Control).BorderStyle := bsNone;
|
||||
|
||||
//special case: in root zone (empty dock site)
|
||||
|
||||
@ -798,6 +801,7 @@ begin
|
||||
OldZone.Free;
|
||||
end;
|
||||
end;
|
||||
Control.Visible := True;
|
||||
ResetBounds(True); //splitters may have to be inserted
|
||||
end;
|
||||
|
||||
@ -944,6 +948,8 @@ begin
|
||||
DockSite.Invalidate;
|
||||
{$ELSE}
|
||||
Control.ManualDock(nil, nil, alNone); //do float
|
||||
{ TODO -cLCL : OnEndDock not called by ManualDock? }
|
||||
TWinControlAccess(Control).DoEndDock(nil, Control.Left, Control.Top);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
@ -10,5 +10,4 @@ object FloatingSite: TFloatingSite
|
||||
OnUnDock = FormUnDock
|
||||
UseDockManager = True
|
||||
LCLVersion = '0.9.29'
|
||||
Visible = True
|
||||
end
|
||||
|
@ -4,5 +4,5 @@ LazarusResources.Add('TFloatingSite','FORMDATA',[
|
||||
'TPF0'#13'TFloatingSite'#12'FloatingSite'#4'Left'#3#175#1#6'Height'#3#9#1#3'T'
|
||||
+'op'#3#242#1#5'Width'#3'y'#1#7'Caption'#6#12'FloatingSite'#8'DockSite'#9#7'O'
|
||||
+'nClose'#7#9'FormClose'#10'OnDockDrop'#7#12'FormDockDrop'#8'OnUnDock'#7#10'F'
|
||||
+'ormUnDock'#14'UseDockManager'#9#10'LCLVersion'#6#6'0.9.29'#7'Visible'#9#0#0
|
||||
+'ormUnDock'#14'UseDockManager'#9#10'LCLVersion'#6#6'0.9.29'#0#0
|
||||
]);
|
||||
|
@ -243,7 +243,6 @@ var
|
||||
Res: TWinControlAccess absolute AForm;
|
||||
begin
|
||||
Result := nil;
|
||||
AForm.Visible := True;
|
||||
//check already dockable
|
||||
{ TODO -cdocking : problems with IDE windows:
|
||||
wrapping results in exceptions - conflicts with OnEndDock? }
|
||||
@ -258,7 +257,7 @@ begin
|
||||
Site := WrapDockable(AForm);
|
||||
AForm.EnableAlign;
|
||||
end;
|
||||
//make visible, so that it can be docked without problems
|
||||
//IDE?
|
||||
if ForIDE and fWrap and assigned(Site) and assigned(Site.DockManager) then begin
|
||||
Site.Invalidate;
|
||||
end;
|
||||
@ -280,8 +279,9 @@ begin
|
||||
if AName <> '' then begin
|
||||
Result := Screen.FindForm(AName);
|
||||
if Result <> nil then begin
|
||||
//if DisableUpdate then Result.DisableAutoSizing;
|
||||
{$IFDEF ForceVisible}
|
||||
Result.Visible := True; //empty edit book?
|
||||
{$ENDIF}
|
||||
exit; //found it
|
||||
end;
|
||||
end;
|
||||
@ -648,6 +648,8 @@ begin
|
||||
The name is split into basename and instance number.
|
||||
A component of T<basename> is created (and named AName - automatic!).
|
||||
|
||||
The form is not made visible by default.
|
||||
|
||||
Result type? (a TWinControl is sufficient as a DockSite)
|
||||
*)
|
||||
//search existing forms
|
||||
@ -655,7 +657,9 @@ begin
|
||||
Result := Screen.FindForm(AName);
|
||||
if Result <> nil then begin
|
||||
//if DisableUpdate then Result.DisableAlign;
|
||||
{$IFDEF ForceVisible}
|
||||
Result.Visible := True; //empty edit book?
|
||||
{$ENDIF}
|
||||
exit; //found it
|
||||
end;
|
||||
end;
|
||||
@ -699,7 +703,7 @@ begin
|
||||
TryRename(Result, AName);
|
||||
end;
|
||||
//if not DisableUpdate then Result.EnableAlign;
|
||||
Result.Visible := True; //required for docking
|
||||
//Result.Visible := True; //required for docking
|
||||
end;
|
||||
|
||||
function TDockMaster.WrapDockable(Client: TControl): TFloatingSite;
|
||||
@ -716,7 +720,7 @@ begin
|
||||
*)
|
||||
if (csDestroying in Client.ComponentState)
|
||||
or assigned(Client.HostDockSite) //already wrapped
|
||||
or not Client.Visible //or force visible (below)?
|
||||
//or not Client.Visible //or force visible (below)?
|
||||
then
|
||||
exit(nil); //do nothing with client under destruction!
|
||||
|
||||
@ -729,9 +733,13 @@ begin
|
||||
r.Bottom := r.Top + Client.UndockHeight;
|
||||
Site.BoundsRect := r;
|
||||
//DebugLn('Before Wrap: ', DbgS(Site.BoundsRect));
|
||||
//Site.Visible := True;
|
||||
Client.Align := alNone;
|
||||
//Client.Visible := True; //otherwise docking may be rejected - see above
|
||||
//retry make client auto-dockable
|
||||
ctl.DragKind := dkDock;
|
||||
ctl.DragMode := dmAutomatic;
|
||||
{$IFDEF ForceVisible}
|
||||
Client.Visible := True;
|
||||
{$ENDIF}
|
||||
Client.ManualDock(Site);
|
||||
//DebugLn('After Wrap: ', DbgS(Site.BoundsRect));
|
||||
|
||||
@ -748,9 +756,10 @@ begin
|
||||
Site.Release;
|
||||
raise;
|
||||
end;
|
||||
//retry make client auto-dockable
|
||||
{//retry make client auto-dockable
|
||||
ctl.DragKind := dkDock;
|
||||
ctl.DragMode := dmAutomatic;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TDockMaster.DumpSites;
|
||||
|
Loading…
Reference in New Issue
Block a user