mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-25 07:18:08 +02:00
lcl: use active form as parent for pmNone and modal windows. Issue #29635
git-svn-id: trunk@51597 -
This commit is contained in:
parent
44e40b779d
commit
2c0c39f762
@ -1492,7 +1492,8 @@
|
||||
</notes>
|
||||
</element>
|
||||
<element name="TPopupMode.pmNone">
|
||||
<short>modal: popup to mainform/taskbar window; non-modal: no window parent</short>
|
||||
<short>modal: popup to active form or if not available, to main form; non-modal: no window parent</short>
|
||||
<descr>For modal windows, the handle has to be recreated in ShowModal. If this is not wanted, please use explicitely pmAuto before calling ShowModal.</descr>
|
||||
</element>
|
||||
<element name="TPopupMode.pmAuto">
|
||||
<short>modal & non-modal: popup to active form or if not available, to main form</short>
|
||||
|
||||
@ -390,7 +390,7 @@ type
|
||||
);
|
||||
|
||||
TPopupMode = (
|
||||
pmNone, // modal: popup to mainform/taskbar window; non-modal: no window parent
|
||||
pmNone, // modal: popup to active form or if not available, to main form; non-modal: no window parent
|
||||
pmAuto, // modal & non-modal: popup to active form or if not available, to main form
|
||||
pmExplicit // modal & non-modal: popup to PopupParent or if not available, to main form
|
||||
);
|
||||
|
||||
@ -1486,15 +1486,16 @@ begin
|
||||
(PopupMode in [pmAuto, pmExplicit]) // set WndParent of non-modal windows only for pmAuto, pmExplicit
|
||||
then
|
||||
begin
|
||||
case PopupMode of
|
||||
pmAuto:
|
||||
begin
|
||||
Result := Screen.ActiveForm;
|
||||
if (Result<>nil) and (Result.FormStyle = fsSplash) then // ignore fsSplash
|
||||
Result := nil;
|
||||
end;
|
||||
pmExplicit: Result := PopupParent;
|
||||
end;
|
||||
if (PopupMode = pmAuto)
|
||||
or ((PopupMode = pmNone) and (fsModal in FormState)) then
|
||||
begin
|
||||
Result := Screen.ActiveForm;
|
||||
if (Result<>nil) and (Result.FormStyle = fsSplash) then // ignore fsSplash
|
||||
Result := nil;
|
||||
end else
|
||||
if (PopupMode = pmExplicit) then
|
||||
Result := PopupParent;
|
||||
|
||||
if (Result = nil) or not Result.HandleAllocated then
|
||||
Result := Application.MainForm;
|
||||
end;
|
||||
@ -2900,6 +2901,11 @@ begin
|
||||
Application.ModalStarted;
|
||||
try
|
||||
Include(FFormState, fsModal);
|
||||
if PopupMode = pmNone then
|
||||
begin
|
||||
RecreateWnd(Self);
|
||||
HandleNeeded;
|
||||
end;
|
||||
ActiveWindow := GetActiveWindow;
|
||||
SavedFocusState := SaveFocusState;
|
||||
SavedCursor := Screen.Cursor;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user