mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 01:19:29 +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
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Dialogs, LResources, Printers, OsPrinters;
|
Classes, SysUtils, Forms, Controls, Dialogs, LResources, Printers, OsPrinters;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -61,6 +61,15 @@ begin
|
|||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
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 }
|
{ TPageSetupDialog }
|
||||||
|
|
||||||
@ -96,7 +105,7 @@ begin
|
|||||||
else
|
else
|
||||||
lCustData := 0;
|
lCustData := 0;
|
||||||
Flags := PSD_MARGINS or PSD_ENABLEPAGESETUPHOOK;
|
Flags := PSD_MARGINS or PSD_ENABLEPAGESETUPHOOK;
|
||||||
hWndOwner := Widgetset.AppHandle;
|
hWndOwner := GetOwnerHandle(Self);
|
||||||
rtMargin := fMargins;
|
rtMargin := fMargins;
|
||||||
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
||||||
// Pdev.DevMode has the required size, just copy to the global memory
|
// Pdev.DevMode has the required size, just copy to the global memory
|
||||||
@ -207,7 +216,7 @@ begin
|
|||||||
else
|
else
|
||||||
lCustData := 0;
|
lCustData := 0;
|
||||||
Flags := PD_PRINTSETUP or PD_RETURNDC or PD_ENABLESETUPHOOK;
|
Flags := PD_PRINTSETUP or PD_RETURNDC or PD_ENABLESETUPHOOK;
|
||||||
hWndOwner := Widgetset.AppHandle;
|
hWndOwner := GetOwnerHandle(self);
|
||||||
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
PDev := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
||||||
// Pdev.DevMode has the required size, just copy to the global memory
|
// Pdev.DevMode has the required size, just copy to the global memory
|
||||||
DeviceMode := GlobalAlloc(GHND, PDev.DevModeSize);
|
DeviceMode := GlobalAlloc(GHND, PDev.DevModeSize);
|
||||||
@ -335,7 +344,7 @@ begin
|
|||||||
if (poHelp in Options) then Flags := Flags or PD_SHOWHELP;
|
if (poHelp in Options) then Flags := Flags or PD_SHOWHELP;
|
||||||
if not (poWarning in Options) then Flags := Flags or PD_NOWARNING;
|
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 := TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
|
||||||
// Pdev.DevMode has the required size, just copy to the global memory
|
// Pdev.DevMode has the required size, just copy to the global memory
|
||||||
DeviceMode := GlobalAlloc(GHND, PDEV.DevModeSize);
|
DeviceMode := GlobalAlloc(GHND, PDEV.DevModeSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user