diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp index ddb40d4f41..cad19e744b 100644 --- a/lcl/dialogs.pp +++ b/lcl/dialogs.pp @@ -632,6 +632,7 @@ type FText: TTranslateString; FTitle: TTranslateString; FVerificationText: TTranslateString; + FWidth: Integer; FOnButtonClicked: TTaskDlgClickEvent; procedure DoOnButtonClickedHandler(Sender: PTaskDialog; AButtonID: Integer; var ACanClose: Boolean); @@ -663,6 +664,7 @@ type property Text: TTranslateString read FText write FText; property Title: TTranslateString read FTitle write FTitle; property VerificationText: TTranslateString read FVerificationText write FVerificationText; + property Width: Integer read FWidth write FWidth default 0; property OnButtonClicked: TTaskDlgClickEvent read FOnButtonClicked write FOnButtonClicked; end; @@ -682,6 +684,7 @@ type property Text; property Title; property VerificationText; + property Width; property OnButtonClicked; end; diff --git a/lcl/include/taskdialog.inc b/lcl/include/taskdialog.inc index 60ea084b19..021944bbd7 100644 --- a/lcl/include/taskdialog.inc +++ b/lcl/include/taskdialog.inc @@ -240,7 +240,7 @@ begin TaskDlg.Verify := VerificationText; ButtonID := TaskDlg.Execute(TD_COMMONBUTTONS(CommonButtons), DefBtn, TD_FLAGS(Flags), TF_DIALOGICON(MainIcon), TF_FOOTERICON(FooterIcon), - DefRB, 0, ParentWnd, tfForceNonNative in Flags, False, @DoOnButtonClickedHandler); + DefRB, FWidth, ParentWnd, tfForceNonNative in Flags, False, @DoOnButtonClickedHandler); Result := ButtonID>=0; FModalResult := ButtonIDToModalResult(ButtonID); diff --git a/lcl/lcltaskdialog.pas b/lcl/lcltaskdialog.pas index 8374796b11..47d560386c 100644 --- a/lcl/lcltaskdialog.pas +++ b/lcl/lcltaskdialog.pas @@ -783,7 +783,8 @@ begin {$ifdef MSWINDOWS} if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and Assigned(TaskDialogIndirect) and not aNonNative and - not (tdfQuery in aFlags) and (Selection='') then begin + not (tdfQuery in aFlags) and (Selection='') then + begin Dialog.Emulated := False; // use Vista/Seven TaskDialog implementation (not tdfQuery nor Selection) FillChar(Config{%H-},sizeof(Config),0); @@ -845,13 +846,14 @@ begin FontHeight := Dialog.Form.Font.Height; if FontHeight = 0 then FontHeight := Screen.SystemFont.Height; - if aWidth=0 then begin + if aWidth<=0 then begin aWidth := Dialog.Form.Canvas.TextWidth(Inst); if (aWidth>300) or (Dialog.Form.Canvas.TextWidth(Content)>300) or (length(Buttons)>40) then aWidth := 480 else aWidth := 420; - end; + end else + if aWidth<120 then aWidth := 120; Dialog.Form.ClientWidth := aWidth; Dialog.Form.Height := 200; Dialog.Form.Caption := Title;