mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 04:49:19 +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
|
||||
X, Y : integer;
|
||||
p: TPosition;
|
||||
begin
|
||||
if (Parent = nil) and (ParentWindow = 0) then
|
||||
begin
|
||||
@ -1140,7 +1141,10 @@ begin
|
||||
X := Left;
|
||||
Y := Top;
|
||||
|
||||
if (Position = poMainFormCenter)
|
||||
p:=Position;
|
||||
if (Position = poMainFormCenter) and (Application.Mainform=nil) then
|
||||
p:=poScreenCenter;
|
||||
if (P = poMainFormCenter)
|
||||
and (FormStyle = fsMDIChild)
|
||||
and (Self <> Application.Mainform)
|
||||
then begin
|
||||
@ -1148,7 +1152,7 @@ begin
|
||||
Y := (Application.Mainform.ClientHeight - Height) div 2;
|
||||
end
|
||||
else begin
|
||||
case Position of
|
||||
case P of
|
||||
poDesktopCenter :
|
||||
begin
|
||||
X := (Screen.DesktopWidth - Width) div 2;
|
||||
|
Loading…
Reference in New Issue
Block a user