mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-24 11:39:17 +02:00
Printers: Get correct owner handle for printers dialogs. Issue #28280, patch from Derit Agustin.
git-svn-id: trunk@49322 -
This commit is contained in:
parent
95725008c2
commit
1efce4eaa0
@ -22,7 +22,7 @@ unit PrintersDlgs;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Dialogs, LResources, Printers, OsPrinters;
|
||||
Classes, SysUtils, Forms, Controls, Dialogs, LResources, Printers, OsPrinters;
|
||||
|
||||
type
|
||||
|
||||
|
@ -61,6 +61,15 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function GetOwnerHandle(ADialog : TCommonDialog): HWND;
|
||||
begin
|
||||
with ADialog do
|
||||
if Owner is TWinControl then
|
||||
Result := TWinControl(Owner).Handle
|
||||
else
|
||||
Result := WidgetSet.AppHandle;
|
||||
end;
|
||||
|
||||
|
||||
{ TPageSetupDialog }
|
||||
|
||||
@ -96,7 +105,7 @@ begin
|
||||
else
|
||||
lCustData := 0;
|
||||
Flags := PSD_MARGINS or PSD_ENABLEPAGESETUPHOOK;
|
||||
hWndOwner := Widgetset.AppHandle;
|
||||
hWndOwner := GetOwnerHandle(Self);
|
||||
rtMargin := fMargins;
|
||||
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
||||
// Pdev.DevMode has the required size, just copy to the global memory
|
||||
@ -207,7 +216,7 @@ begin
|
||||
else
|
||||
lCustData := 0;
|
||||
Flags := PD_PRINTSETUP or PD_RETURNDC or PD_ENABLESETUPHOOK;
|
||||
hWndOwner := Widgetset.AppHandle;
|
||||
hWndOwner := GetOwnerHandle(self);
|
||||
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
||||
// Pdev.DevMode has the required size, just copy to the global memory
|
||||
DeviceMode := GlobalAlloc(GHND, PDev.DevModeSize);
|
||||
@ -335,7 +344,7 @@ begin
|
||||
if (poHelp in Options) then Flags := Flags or PD_SHOWHELP;
|
||||
if not (poWarning in Options) then Flags := Flags or PD_NOWARNING;
|
||||
|
||||
hWndOwner := Widgetset.AppHandle;
|
||||
hWndOwner := GetOwnerHandle(self);
|
||||
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
||||
// Pdev.DevMode has the required size, just copy to the global memory
|
||||
DeviceMode := GlobalAlloc(GHND, PDEV.DevModeSize);
|
||||
|
Loading…
Reference in New Issue
Block a user