lcl: disable windows on system dialog execute

win32: fix parent window handle for system dialogs
Issue #28631

git-svn-id: trunk@51798 -
This commit is contained in:
ondrej 2016-03-02 05:45:52 +00:00
parent d450b6a0ab
commit f7158c1393
14 changed files with 40 additions and 57 deletions

View File

@ -6,7 +6,7 @@ const
{ TPageSetupDialog }
function TPageSetupDialog.Execute: Boolean;
function TPageSetupDialog.DoExecute: Boolean;
var
CarbonPrinter: TCarbonPrinter;
begin
@ -27,7 +27,7 @@ end;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
function TPrinterSetupDialog.DoExecute: Boolean;
begin
Result := False;
if not Assigned(Printer) then Exit;
@ -39,7 +39,7 @@ end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
function TPrintDialog.DoExecute: Boolean;
var
CarbonPrinter: TCarbonPrinter;
DialogSettings: PMPrintSettings;

View File

@ -6,7 +6,7 @@ const
{ TPageSetupDialog }
function TPageSetupDialog.Execute: Boolean;
function TPageSetupDialog.DoExecute: Boolean;
var
CocoaPrinter: TCocoaPrinter;
begin
@ -27,7 +27,7 @@ end;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
function TPrinterSetupDialog.DoExecute: Boolean;
begin
Result := False;
if not Assigned(Printer) then Exit;
@ -39,7 +39,7 @@ end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
function TPrintDialog.DoExecute: Boolean;
var
CocoaPrinter: TCocoaPrinter;
PrintPanel: NSPrintPanel;

View File

@ -35,9 +35,10 @@ type
private
fMargins : TRect;
fUnits : TMeasureUnits;
protected
function DoExecute: Boolean; override;
public
constructor Create(TheOwner: TComponent); override;
function Execute: Boolean; override;
property Margins : TRect read fMargins write fMargins;
property Units : TMeasureUnits read fUnits;
end;
@ -45,15 +46,15 @@ type
{ TPrinterDialog }
TPrinterSetupDialog = class(TCustomPrinterSetupDialog)
public
function Execute: Boolean; override;
protected
function DoExecute: Boolean; override;
end;
{ TPrintDialog }
TPrintDialog = class(TCustomPrintDialog)
public
function Execute: Boolean; override;
protected
function DoExecute: Boolean; override;
published
property Collate;
property Copies;

View File

@ -3,7 +3,7 @@
{ TPageSetupDialog }
function TPageSetupDialog.Execute: Boolean;
function TPageSetupDialog.DoExecute: Boolean;
var
PgDlg: QPageSetupDialogH;
Str: WideString;
@ -38,7 +38,7 @@ end;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
function TPrinterSetupDialog.DoExecute: Boolean;
var
PgDlg: QPageSetupDialogH;
Str: WideString;
@ -74,7 +74,7 @@ end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
function TPrintDialog.DoExecute: Boolean;
var
QtPrnDlg: QPrintDialogH;
PrnOptions: QAbstractPrintDialogPrintDialogOptions;

View File

@ -1,7 +1,7 @@
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
function TPrinterSetupDialog.DoExecute: Boolean;
Var Dlg : Tdlgpropertiesprinter;
begin
Dlg:=TdlgPropertiesPrinter.Create(nil);
@ -54,7 +54,7 @@ end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
function TPrintDialog.DoExecute: Boolean;
Var
Dlg : TdlgSelectPrinter;
i : Integer;
@ -114,7 +114,7 @@ end;
{ TPrintDialog }
function TPageSetupDialog.Execute: Boolean;
function TPageSetupDialog.DoExecute: Boolean;
var
Dlg: TDlgPageSetup;
begin

View File

@ -67,7 +67,7 @@ end;
{ TPageSetupDialog }
function TPageSetupDialog.Execute: Boolean;
function TPageSetupDialog.DoExecute: Boolean;
var
lpp : tagPSD;
PDev : TPrinterDevice;
@ -152,7 +152,7 @@ end;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
function TPrinterSetupDialog.DoExecute: Boolean;
var
lpp : tagPD;
PDev : TPrinterDevice;
@ -231,7 +231,7 @@ end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
function TPrintDialog.DoExecute: Boolean;
var
lpp : tagPD;
PDev : TPrinterDevice;

View File

@ -120,7 +120,6 @@ type
procedure SetFilterIndex(const AValue: Integer);
protected
class procedure WSRegisterClass; override;
function DoExecute: boolean; override;
function GetFilterIndex: Integer; virtual;
procedure SetFileName(const Value: String); virtual;
procedure SetFilter(const Value: String); virtual;
@ -129,7 +128,6 @@ type
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure DoTypeChange; virtual;
function Execute: boolean; override;
property Files: TStrings read FFiles;
property HistoryList: TStrings read FHistoryList write SetHistoryList;
procedure IntfFileTypeChanged(NewFilterIndex: Integer);
@ -423,7 +421,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure CloseDialog;
function Execute: Boolean;override;
function Execute: Boolean; override;
property Left: Integer read GetLeft write SetLeft;
property Position: TPoint read GetPosition write SetPosition;
property Top: Integer read GetTop write SetTop;

View File

@ -54,8 +54,8 @@ type
class procedure WSRegisterClass; override;
procedure CreatePreviewControl; virtual;
procedure InitPreviewControl; virtual;
function DoExecute: boolean; override;
public
function Execute: boolean; override;
constructor Create(TheOwner: TComponent); override;
property PreviewFileControl: TPreviewFileControl read FPreviewFileControl;
end;
@ -290,10 +290,10 @@ begin
FPreviewFileControl.Name:='PreviewFileControl';
end;
function TPreviewFileDialog.Execute: boolean;
function TPreviewFileDialog.DoExecute: boolean;
begin
CreatePreviewControl;
Result:=inherited Execute;
Result:=inherited DoExecute;
end;
constructor TPreviewFileDialog.Create(TheOwner: TComponent);

View File

@ -25,11 +25,18 @@ begin
end;
function TCommonDialog.Execute: boolean;
var
DisabledList: TList;
begin
FUserChoice := mrNone;
Handle := TWSCommonDialogClass(WidgetSetClass).CreateHandle(Self);
Result:= DoExecute;
Close;
DisabledList := Screen.DisableForms(nil);
try
FUserChoice := mrNone;
Handle := TWSCommonDialogClass(WidgetSetClass).CreateHandle(Self);
Result:= DoExecute;
Close;
finally
Screen.EnableForms(DisabledList);
end;
end;
procedure TCommonDialog.Close;

View File

@ -45,14 +45,6 @@ begin
OnTypeChange(Self);
end;
{------------------------------------------------------------------------------}
{ TFileDialog Execute }
{------------------------------------------------------------------------------}
function TFileDialog.Execute : boolean;
begin
Result:=inherited Execute;
end;
{------------------------------------------------------------------------------
TFileDialog DoExecute
------------------------------------------------------------------------------}
@ -199,14 +191,6 @@ begin
RegisterFileDialog;
end;
{------------------------------------------------------------------------------
TFileDialog DoExecute
------------------------------------------------------------------------------}
function TFileDialog.DoExecute : boolean;
begin
Result:= inherited DoExecute;
end;
{------------------------------------------------------------------------------
TFileDialog GetFilterIndex
------------------------------------------------------------------------------}

View File

@ -845,7 +845,6 @@ end;
class function TGtkWSCommonDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
begin
Result := 0;
DebugLn('TGtkWSCommonDialog.CreateHandle is generic dialog handle constructor => implement CreateHandle for: ', dbgsName(ACommonDialog))
end;
class procedure TGtkWSCommonDialog.DestroyHandle(const ACommonDialog: TCommonDialog);

View File

@ -1217,7 +1217,6 @@ class function TGtk2WSCommonDialog.CreateHandle(
const ACommonDialog: TCommonDialog): THandle;
begin
Result := 0;
DebugLn('TGtkWSCommonDialog.CreateHandle is generic dialog handle constructor => implement CreateHandle for: ', dbgsName(ACommonDialog))
end;
class procedure TGtk2WSCommonDialog.ShowModal(const ACommonDialog: TCommonDialog);

View File

@ -1514,7 +1514,6 @@ class function TGtk3WSCommonDialog.CreateHandle(
const ACommonDialog: TCommonDialog): THandle;
begin
Result := 0;
DebugLn('TGtkWSCommonDialog.CreateHandle is generic dialog handle constructor => implement CreateHandle for: ', dbgsName(ACommonDialog))
end;
class procedure TGtk3WSCommonDialog.ShowModal(const ACommonDialog: TCommonDialog);

View File

@ -307,13 +307,10 @@ end;
------------------------------------------------------------------------------}
function GetOwnerHandle(ADialog : TCommonDialog): HWND;
begin
with ADialog do
begin
if Owner is TWinControl then
Result := TWinControl(Owner).Handle
else
Result := TWin32WidgetSet(WidgetSet).AppHandle;
end;
if (Screen.ActiveForm<>nil) and Screen.ActiveForm.HandleAllocated then
Result := Screen.ActiveForm.Handle
else
Result := Application.MainFormHandle;
end;
procedure SetDialogResult(const ACommonDialog: TCommonDialog; Ret: WINBOOL);
@ -1097,7 +1094,6 @@ end;
class function TWin32WSCommonDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
begin
DebugLn('TWin32WSCommonDialog.CreateHandle: unhandled dialog!');
Result := 0;
end;