mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 09:20:48 +02:00
dockmanager example: handle record properties properly
git-svn-id: trunk@19960 -
This commit is contained in:
parent
d03621adc4
commit
edc2afd189
@ -362,7 +362,10 @@ Cases 2 and 3 can be merged, with an additional or redundant setting of the orie
|
|||||||
*)
|
*)
|
||||||
begin
|
begin
|
||||||
if Control = FReplacingControl then begin
|
if Control = FReplacingControl then begin
|
||||||
//hack for morphing DropCtl into notebook
|
(* hack for morphing DropCtl into notebook,
|
||||||
|
or initial docking of undocked controls in the dock site.
|
||||||
|
Everything is done by the caller, after ManualDock.
|
||||||
|
*)
|
||||||
FReplacingControl := nil;
|
FReplacingControl := nil;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -412,7 +415,7 @@ begin
|
|||||||
DropCtl := NoteBook; //put further controls into the notebook
|
DropCtl := NoteBook; //put further controls into the notebook
|
||||||
ResetBounds(True); //for some reason only setting the size doesn't work
|
ResetBounds(True); //for some reason only setting the size doesn't work
|
||||||
NoteBook.Update;
|
NoteBook.Update;
|
||||||
end;
|
end; //else use existing control
|
||||||
Control.ManualDock(TPageControl(DropCtl));
|
Control.ManualDock(TPageControl(DropCtl));
|
||||||
FDockSite.Invalidate;
|
FDockSite.Invalidate;
|
||||||
exit;
|
exit;
|
||||||
@ -599,9 +602,6 @@ var
|
|||||||
if z.ChildControl <> nil then begin
|
if z.ChildControl <> nil then begin
|
||||||
//paint header
|
//paint header
|
||||||
ACaption := DockSite.GetDockCaption(z.ChildControl);
|
ACaption := DockSite.GetDockCaption(z.ChildControl);
|
||||||
//ACaption := z.ChildControl.Name;
|
|
||||||
//ACaption := z.ChildControl.ClassName;
|
|
||||||
//ACaption := z.ChildControl.DefaultDockCaption;
|
|
||||||
FHeader.Draw(z, ACanvas, ACaption, MousePos);
|
FHeader.Draw(z, ACanvas, ACaption, MousePos);
|
||||||
end else begin
|
end else begin
|
||||||
//paint children
|
//paint children
|
||||||
@ -656,7 +656,8 @@ var
|
|||||||
//zone := zInnermost;
|
//zone := zInnermost;
|
||||||
dir := alCustom; //alClient?
|
dir := alCustom; //alClient?
|
||||||
end else begin
|
end else begin
|
||||||
{
|
{ future feature: inner and outer location.
|
||||||
|
outmost location intended to span all siblings.
|
||||||
if izone >= k-1 then
|
if izone >= k-1 then
|
||||||
zone := zOuter
|
zone := zOuter
|
||||||
else //if izone > 0 then
|
else //if izone > 0 then
|
||||||
@ -681,8 +682,9 @@ Signal results:
|
|||||||
|
|
||||||
Unfortunately there exists no way to signal invalid docking attempts :-(
|
Unfortunately there exists no way to signal invalid docking attempts :-(
|
||||||
*)
|
*)
|
||||||
//determine the zone containing the DragTargetPos
|
//debug only
|
||||||
DockObj := ADockObject;
|
DockObj := ADockObject;
|
||||||
|
//determine the zone containing the DragTargetPos
|
||||||
with ADockObject do begin
|
with ADockObject do begin
|
||||||
//mouse position within dock site
|
//mouse position within dock site
|
||||||
DragTargetPos := DragTarget.ScreenToClient(DragPos);
|
DragTargetPos := DragTarget.ScreenToClient(DragPos);
|
||||||
@ -692,32 +694,33 @@ Signal results:
|
|||||||
if (zone = nil) or (Control = zone.ChildControl) then begin
|
if (zone = nil) or (Control = zone.ChildControl) then begin
|
||||||
DropAlign := alNone; //prevent drop (below)
|
DropAlign := alNone; //prevent drop (below)
|
||||||
end else begin
|
end else begin
|
||||||
|
ADockRect := zone.GetBounds; //include header
|
||||||
DropOnControl := zone.ChildControl;
|
DropOnControl := zone.ChildControl;
|
||||||
if DropOnControl = nil then begin
|
if DropOnControl = nil then begin
|
||||||
DropAlign := alClient; //first element in entire site
|
DropAlign := alClient; //first element in entire site
|
||||||
end else begin
|
end else //determine the alignment within the zone.
|
||||||
//determined the alignment within the zone.
|
|
||||||
ADockRect := zone.GetBounds; //include header
|
|
||||||
DropAlign := DetectAlign(zone.BR, DragTargetPos);
|
DropAlign := DetectAlign(zone.BR, DragTargetPos);
|
||||||
//to screen coords
|
//to screen coords
|
||||||
ADockRect.TopLeft := FDockSite.ClientToScreen(ADockRect.TopLeft);
|
ADockRect.TopLeft := FDockSite.ClientToScreen(ADockRect.TopLeft);
|
||||||
ADockRect.BottomRight := FDockSite.ClientToScreen(ADockRect.BottomRight);
|
ADockRect.BottomRight := FDockSite.ClientToScreen(ADockRect.BottomRight);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
//position DockRect
|
//position DockRect
|
||||||
if DropAlign = alNone then begin
|
if DropAlign = alNone then begin
|
||||||
|
//force DockRect update by DockTrackNoTarget
|
||||||
DropOnControl := Control; //prevent drop - signal drop onto self
|
DropOnControl := Control; //prevent drop - signal drop onto self
|
||||||
{$IFDEF NoDrop}
|
{$IFDEF NoDrop}
|
||||||
NoDrop := True;
|
NoDrop := True;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
|
DragTarget := nil;
|
||||||
|
//Control.DockTrackNoTarget
|
||||||
//DragTarget := FDockSite; //prevent floating - doesn't work :-(
|
//DragTarget := FDockSite; //prevent floating - doesn't work :-(
|
||||||
//DockRect := Rect(MaxInt, MaxInt, 0, 0); //LTRB - very strange effect!
|
//DockRect := Rect(MaxInt, MaxInt, 0, 0); //LTRB - very strange effect!
|
||||||
//DockRect := Rect(MaxInt, 0, MaxInt, 0); //LTRB
|
//DockRect := Rect(MaxInt, 0, MaxInt, 0); //LTRB
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end else begin
|
end else begin
|
||||||
PositionDockRect(Control, DropOnControl, DropAlign, ADockRect);
|
PositionDockRect(Control, DropOnControl, DropAlign, ADockRect);
|
||||||
|
DockRect := ADockRect;
|
||||||
end;
|
end;
|
||||||
DockRect := ADockRect;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1260,13 +1263,25 @@ end;
|
|||||||
procedure TEasyZone.SetBounds(TLBR: TRect);
|
procedure TEasyZone.SetBounds(TLBR: TRect);
|
||||||
var
|
var
|
||||||
z: TEasyZone;
|
z: TEasyZone;
|
||||||
|
r, rc: TRect;
|
||||||
begin
|
begin
|
||||||
(* Zone cannot be the root zone. If so, ignore?
|
(* Zone cannot be the root zone. If so, ignore?
|
||||||
Recurse into child zones.
|
Recurse into child zones.
|
||||||
*)
|
*)
|
||||||
BR := TLBR.BottomRight;
|
BR := TLBR.BottomRight;
|
||||||
if ChildControl <> nil then begin //is control zone
|
if ChildControl <> nil then begin //is control zone
|
||||||
ChildControl.BoundsRect := GetPartRect(zpClient);
|
ChildControl.Align := alNone;
|
||||||
|
r := GetPartRect(zpClient);
|
||||||
|
ChildControl.BoundsRect := r;
|
||||||
|
rc := ChildControl.BoundsRect;
|
||||||
|
//check control reacted properly
|
||||||
|
if not CompareMem(@r, @rc, sizeof(r)) then begin
|
||||||
|
with r do begin
|
||||||
|
DebugLn('BoundsRect as (%d,%d)-(%d,%d)', [Top, Left, Bottom, Right]);
|
||||||
|
end;
|
||||||
|
with rc do
|
||||||
|
DebugLn('BoundsRect is (%d,%d)-(%d,%d)', [Top, Left, Bottom, Right]);
|
||||||
|
end;
|
||||||
end else if FirstChild <> nil then begin
|
end else if FirstChild <> nil then begin
|
||||||
z := FirstChild;
|
z := FirstChild;
|
||||||
while z <> nil do begin
|
while z <> nil do begin
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
{ Das ist eine automatisch erzeugte Lazarus-Ressourcendatei }
|
|
||||||
|
|
||||||
LazarusResources.Add('TEasyDockMain','FORMDATA',[
|
LazarusResources.Add('TEasyDockMain','FORMDATA',[
|
||||||
'TPF0'#13'TEasyDockMain'#12'EasyDockMain'#4'Left'#3#168#2#6'Height'#3#29#1#3
|
'TPF0'#13'TEasyDockMain'#12'EasyDockMain'#4'Left'#3#168#2#6'Height'#3#29#1#3
|
||||||
+'Top'#2'}'#5'Width'#3#205#1#13'ActiveControl'#7#6'buDump'#7'Caption'#6#12'Ea'
|
+'Top'#2'}'#5'Width'#3#205#1#13'ActiveControl'#7#6'buDump'#7'Caption'#6#12'Ea'
|
||||||
|
@ -14,7 +14,7 @@ unit fMain;
|
|||||||
|
|
||||||
//some defines, to demonstrate LCL flaws
|
//some defines, to demonstrate LCL flaws
|
||||||
{$DEFINE Docker} //using control (undef: entire form) as dock site
|
{$DEFINE Docker} //using control (undef: entire form) as dock site
|
||||||
{.$DEFINE easy} //using EasyDockSite (undef: default LDockTree)
|
{$DEFINE easy} //using EasyDockSite (undef: default LDockTree)
|
||||||
{.$DEFINE dragForm} //create a form from the draggable images (or drag images)
|
{.$DEFINE dragForm} //create a form from the draggable images (or drag images)
|
||||||
//dragging forms is not supported on all platforms!
|
//dragging forms is not supported on all platforms!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user