mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-18 17:26:22 +02:00
LCL/TaskDialog: Add new property Width to override the default width.
This commit is contained in:
parent
c7164f5b58
commit
68e6168982
@ -632,6 +632,7 @@ type
|
|||||||
FText: TTranslateString;
|
FText: TTranslateString;
|
||||||
FTitle: TTranslateString;
|
FTitle: TTranslateString;
|
||||||
FVerificationText: TTranslateString;
|
FVerificationText: TTranslateString;
|
||||||
|
FWidth: Integer;
|
||||||
FOnButtonClicked: TTaskDlgClickEvent;
|
FOnButtonClicked: TTaskDlgClickEvent;
|
||||||
procedure DoOnButtonClickedHandler(Sender: PTaskDialog; AButtonID: Integer;
|
procedure DoOnButtonClickedHandler(Sender: PTaskDialog; AButtonID: Integer;
|
||||||
var ACanClose: Boolean);
|
var ACanClose: Boolean);
|
||||||
@ -663,6 +664,7 @@ type
|
|||||||
property Text: TTranslateString read FText write FText;
|
property Text: TTranslateString read FText write FText;
|
||||||
property Title: TTranslateString read FTitle write FTitle;
|
property Title: TTranslateString read FTitle write FTitle;
|
||||||
property VerificationText: TTranslateString read FVerificationText write FVerificationText;
|
property VerificationText: TTranslateString read FVerificationText write FVerificationText;
|
||||||
|
property Width: Integer read FWidth write FWidth default 0;
|
||||||
property OnButtonClicked: TTaskDlgClickEvent read FOnButtonClicked write FOnButtonClicked;
|
property OnButtonClicked: TTaskDlgClickEvent read FOnButtonClicked write FOnButtonClicked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -682,6 +684,7 @@ type
|
|||||||
property Text;
|
property Text;
|
||||||
property Title;
|
property Title;
|
||||||
property VerificationText;
|
property VerificationText;
|
||||||
|
property Width;
|
||||||
property OnButtonClicked;
|
property OnButtonClicked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ begin
|
|||||||
TaskDlg.Verify := VerificationText;
|
TaskDlg.Verify := VerificationText;
|
||||||
|
|
||||||
ButtonID := TaskDlg.Execute(TD_COMMONBUTTONS(CommonButtons), DefBtn, TD_FLAGS(Flags), TF_DIALOGICON(MainIcon), TF_FOOTERICON(FooterIcon),
|
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;
|
Result := ButtonID>=0;
|
||||||
FModalResult := ButtonIDToModalResult(ButtonID);
|
FModalResult := ButtonIDToModalResult(ButtonID);
|
||||||
|
|
||||||
|
@ -783,7 +783,8 @@ begin
|
|||||||
{$ifdef MSWINDOWS}
|
{$ifdef MSWINDOWS}
|
||||||
if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and
|
if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and
|
||||||
Assigned(TaskDialogIndirect) and not aNonNative 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;
|
Dialog.Emulated := False;
|
||||||
// use Vista/Seven TaskDialog implementation (not tdfQuery nor Selection)
|
// use Vista/Seven TaskDialog implementation (not tdfQuery nor Selection)
|
||||||
FillChar(Config{%H-},sizeof(Config),0);
|
FillChar(Config{%H-},sizeof(Config),0);
|
||||||
@ -845,13 +846,14 @@ begin
|
|||||||
FontHeight := Dialog.Form.Font.Height;
|
FontHeight := Dialog.Form.Font.Height;
|
||||||
if FontHeight = 0 then
|
if FontHeight = 0 then
|
||||||
FontHeight := Screen.SystemFont.Height;
|
FontHeight := Screen.SystemFont.Height;
|
||||||
if aWidth=0 then begin
|
if aWidth<=0 then begin
|
||||||
aWidth := Dialog.Form.Canvas.TextWidth(Inst);
|
aWidth := Dialog.Form.Canvas.TextWidth(Inst);
|
||||||
if (aWidth>300) or (Dialog.Form.Canvas.TextWidth(Content)>300) or
|
if (aWidth>300) or (Dialog.Form.Canvas.TextWidth(Content)>300) or
|
||||||
(length(Buttons)>40) then
|
(length(Buttons)>40) then
|
||||||
aWidth := 480 else
|
aWidth := 480 else
|
||||||
aWidth := 420;
|
aWidth := 420;
|
||||||
end;
|
end else
|
||||||
|
if aWidth<120 then aWidth := 120;
|
||||||
Dialog.Form.ClientWidth := aWidth;
|
Dialog.Form.ClientWidth := aWidth;
|
||||||
Dialog.Form.Height := 200;
|
Dialog.Form.Height := 200;
|
||||||
Dialog.Form.Caption := Title;
|
Dialog.Form.Caption := Title;
|
||||||
|
Loading…
Reference in New Issue
Block a user