mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 03:40:31 +02:00
IDEIntf: designer mediator: fixed GetComponentOriginOnForm
git-svn-id: trunk@21667 -
This commit is contained in:
parent
f34aac3514
commit
b6cf29d755
@ -1549,6 +1549,7 @@ var
|
||||
NewTop:=Min(MouseDownPos.Y,MouseUpPos.Y);
|
||||
if (Mediator<>nil) then begin
|
||||
ParentClientOrigin:=Mediator.GetComponentOriginOnForm(NewParent);
|
||||
DebugLn(['AddComponent ParentClientOrigin=',dbgs(ParentClientOrigin)]);
|
||||
// adjust left,top to parent origin
|
||||
dec(NewLeft,ParentClientOrigin.X);
|
||||
dec(NewTop,ParentClientOrigin.Y);
|
||||
@ -1581,7 +1582,7 @@ var
|
||||
end;
|
||||
|
||||
// create component and component interface
|
||||
DebugLn(['AddComponent ',DbgSName(NewComponentClass),' ',NewLeft,',',NewTop,',',NewWidth,',',NewHeight]);
|
||||
DebugLn(['AddComponent ',DbgSName(NewComponentClass),' Parent=',DbgSName(NewParent),' ',NewLeft,',',NewTop,',',NewWidth,',',NewHeight]);
|
||||
NewCI := TComponentInterface(TheFormEditor.CreateComponent(
|
||||
ParentCI,NewComponentClass,'',
|
||||
NewLeft,NewTop,NewWidth,NewHeight));
|
||||
|
@ -29,8 +29,8 @@ object MyForm1: TMyForm1
|
||||
Visible = False
|
||||
Caption = 'MyGroupBox1'
|
||||
object MyGroupBox2: TMyGroupBox
|
||||
Left = 166
|
||||
Top = 92
|
||||
Left = 10
|
||||
Top = 10
|
||||
Width = 70
|
||||
Height = 53
|
||||
Visible = False
|
||||
|
@ -8,6 +8,6 @@ LazarusResources.Add('TMyForm1','FORMDATA',[
|
||||
+'F'#5'Width'#2'K'#6'Height'#2#25#7'Visible'#8#7'Caption'#6#9'MyButton2'#0#0
|
||||
+#11'TMyGroupBox'#11'MyGroupBox1'#4'Left'#3#144#0#3'Top'#2'A'#5'Width'#2'i'#6
|
||||
+'Height'#2'K'#7'Visible'#8#7'Caption'#6#11'MyGroupBox1'#0#11'TMyGroupBox'#11
|
||||
+'MyGroupBox2'#4'Left'#3#166#0#3'Top'#2'\'#5'Width'#2'F'#6'Height'#2'5'#7'Vis'
|
||||
+'ible'#8#7'Caption'#6#11'MyGroupBox2'#0#0#0#0
|
||||
+'MyGroupBox2'#4'Left'#2#10#3'Top'#2#10#5'Width'#2'F'#6'Height'#2'5'#7'Visibl'
|
||||
+'e'#8#7'Caption'#6#11'MyGroupBox2'#0#0#0#0
|
||||
]);
|
||||
|
@ -415,14 +415,21 @@ var
|
||||
Parent: TComponent;
|
||||
ClientArea: TRect;
|
||||
ScrollOffset: TPoint;
|
||||
ParentBounds: TRect;
|
||||
NextParent: TComponent;
|
||||
begin
|
||||
Result:=Point(0,0);
|
||||
while AComponent<>nil do begin
|
||||
Parent:=AComponent.GetParentComponent;
|
||||
if Parent=nil then break;
|
||||
NextParent:=Parent.GetParentComponent;
|
||||
if NextParent<>nil then
|
||||
GetBounds(Parent,ParentBounds)
|
||||
else
|
||||
ParentBounds:=Rect(0,0,0,0);
|
||||
GetClientArea(Parent,ClientArea,ScrollOffset);
|
||||
inc(Result.X,ClientArea.Left+ScrollOffset.X);
|
||||
inc(Result.Y,ClientArea.Top+ScrollOffset.Y);
|
||||
inc(Result.X,ParentBounds.Left+ClientArea.Left+ScrollOffset.X);
|
||||
inc(Result.Y,ParentBounds.Top+ClientArea.Top+ScrollOffset.Y);
|
||||
AComponent:=Parent;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user