mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-27 08:19:15 +01:00
IDE designer: limit component position to form client area
git-svn-id: trunk@13996 -
This commit is contained in:
parent
5e3feae994
commit
a7714f09e0
@ -716,12 +716,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSelectedControl.SetLeft(ALeft: integer);
|
procedure TSelectedControl.SetLeft(ALeft: integer);
|
||||||
|
var
|
||||||
|
M: Word;
|
||||||
begin
|
begin
|
||||||
if FIsTControl then
|
if FIsTControl then
|
||||||
TControl(FPersistent).Left:=Aleft
|
TControl(FPersistent).Left:=Aleft
|
||||||
else if FIsTComponent then
|
else
|
||||||
LongRec(TComponent(FPersistent).DesignInfo).Lo:=
|
if FIsTComponent then
|
||||||
word(Min(32000,Max(0,ALeft)));
|
begin
|
||||||
|
M := 32000;
|
||||||
|
if DesignerForm <> nil then
|
||||||
|
M := Max(0, Min(M, DesignerForm.ClientWidth - NonVisualCompWidth));
|
||||||
|
|
||||||
|
LongRec(TComponent(FPersistent).DesignInfo).Lo:=
|
||||||
|
word(Min(M, Max(0,ALeft)));
|
||||||
|
end;
|
||||||
|
|
||||||
FCachedLeft:=ALeft;
|
FCachedLeft:=ALeft;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -742,12 +752,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSelectedControl.SetTop(ATop: integer);
|
procedure TSelectedControl.SetTop(ATop: integer);
|
||||||
|
var
|
||||||
|
M: Word;
|
||||||
begin
|
begin
|
||||||
if FIsTControl then
|
if FIsTControl then
|
||||||
TControl(FPersistent).Top:=ATop
|
TControl(FPersistent).Top:=ATop
|
||||||
else if FIsTComponent then
|
else
|
||||||
LongRec(TComponent(FPersistent).DesignInfo).Hi:=
|
if FIsTComponent then
|
||||||
word(Min(32000,Max(0,ATop)));
|
begin
|
||||||
|
M := 32000;
|
||||||
|
if DesignerForm <> nil then
|
||||||
|
M := Max(0, Min(M, DesignerForm.ClientHeight - NonVisualCompWidth));
|
||||||
|
|
||||||
|
LongRec(TComponent(FPersistent).DesignInfo).Hi:=
|
||||||
|
word(Min(M, Max(0,ATop)));
|
||||||
|
end;
|
||||||
|
|
||||||
FCachedTop:=ATop;
|
FCachedTop:=ATop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -1075,10 +1075,10 @@ end;
|
|||||||
|
|
||||||
function TDesigner.NonVisualComponentLeftTop(AComponent: TComponent): TPoint;
|
function TDesigner.NonVisualComponentLeftTop(AComponent: TComponent): TPoint;
|
||||||
begin
|
begin
|
||||||
Result.X:=Min(LongRec(AComponent.DesignInfo).Lo,
|
Result.X:=Max(0, Min(LongRec(AComponent.DesignInfo).Lo,
|
||||||
Form.ClientWidth-NonVisualCompWidth);
|
Form.ClientWidth-NonVisualCompWidth));
|
||||||
Result.Y:=Min(LongRec(AComponent.DesignInfo).Hi,
|
Result.Y:=Max(0, Min(LongRec(AComponent.DesignInfo).Hi,
|
||||||
Form.ClientHeight-NonVisualCompWidth);
|
Form.ClientHeight-NonVisualCompWidth));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDesigner.InvalidateWithParent(AComponent: TComponent);
|
procedure TDesigner.InvalidateWithParent(AComponent: TComponent);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user