mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 08:40:32 +02:00
TTaskDialog: In Execute, use the Handle of the current active form for the ParentWnd parameter.
Based upon the documentation of Delphi: https://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.Dialogs.TCustomTaskDialog.Execute It makes Execute honour the tfRelativeToWindow flag.
This commit is contained in:
parent
732cfd1460
commit
bff41e1f5d
@ -181,8 +181,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomTaskDialog.Execute: Boolean;
|
function TCustomTaskDialog.Execute: Boolean;
|
||||||
|
var
|
||||||
|
AParentWnd: HWND;
|
||||||
begin
|
begin
|
||||||
Result := Execute(0);
|
//See: https://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.Dialogs.TCustomTaskDialog.Execute
|
||||||
|
//If no handle is supplied, then the handle of the active form should be used.
|
||||||
|
//For that Delphi uses Application.ActiveFormHandle (the docs say so).
|
||||||
|
//Currently TApplication does not have a ActiveFormHandle property, so we use our own code for that.
|
||||||
|
if Assigned(Screen.ActiveCustomForm) then
|
||||||
|
AParentWnd := Screen.ActiveCustomForm.Handle
|
||||||
|
else
|
||||||
|
AParentWnd := 0;
|
||||||
|
Result := Execute(AParentWnd);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTaskDialog.SetButtons(const Value: TTaskDialogButtons);
|
procedure TCustomTaskDialog.SetButtons(const Value: TTaskDialogButtons);
|
||||||
|
Loading…
Reference in New Issue
Block a user