mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 03:59:13 +02:00
LCL: fixed crash when poMainFormCenter if there is no mainform
git-svn-id: trunk@24781 -
This commit is contained in:
parent
2e66a93ebd
commit
612e69dc4a
@ -1133,6 +1133,7 @@ procedure TCustomForm.MoveToDefaultPosition;
|
|||||||
|
|
||||||
var
|
var
|
||||||
X, Y : integer;
|
X, Y : integer;
|
||||||
|
p: TPosition;
|
||||||
begin
|
begin
|
||||||
if (Parent = nil) and (ParentWindow = 0) then
|
if (Parent = nil) and (ParentWindow = 0) then
|
||||||
begin
|
begin
|
||||||
@ -1140,7 +1141,10 @@ begin
|
|||||||
X := Left;
|
X := Left;
|
||||||
Y := Top;
|
Y := Top;
|
||||||
|
|
||||||
if (Position = poMainFormCenter)
|
p:=Position;
|
||||||
|
if (Position = poMainFormCenter) and (Application.Mainform=nil) then
|
||||||
|
p:=poScreenCenter;
|
||||||
|
if (P = poMainFormCenter)
|
||||||
and (FormStyle = fsMDIChild)
|
and (FormStyle = fsMDIChild)
|
||||||
and (Self <> Application.Mainform)
|
and (Self <> Application.Mainform)
|
||||||
then begin
|
then begin
|
||||||
@ -1148,7 +1152,7 @@ begin
|
|||||||
Y := (Application.Mainform.ClientHeight - Height) div 2;
|
Y := (Application.Mainform.ClientHeight - Height) div 2;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
case Position of
|
case P of
|
||||||
poDesktopCenter :
|
poDesktopCenter :
|
||||||
begin
|
begin
|
||||||
X := (Screen.DesktopWidth - Width) div 2;
|
X := (Screen.DesktopWidth - Width) div 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user