From 9a3e5c120da683ff6bc701581297f50d71426b80 Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Thu, 20 Jul 2023 20:09:38 +0200 Subject: [PATCH] Refactoring TTaskDialog: - Change signature of TWSTaskDialog.Execute and related functions/methods so we can set ParentWnd and retrieve RadioRes. The TLCLTaskDialog now should act the same as the old emulated version (unit LCLTaskDialog). --- lcl/include/taskdialog.inc | 9 ++++----- lcl/interfaces/win32/win32wsdialogs.pp | 6 +++--- lcl/taskdlgemulation.pp | 22 +++++++++------------- lcl/widgetset/wsdialogs.pp | 6 +++--- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/lcl/include/taskdialog.inc b/lcl/include/taskdialog.inc index 30939bca67..684ef7e6ce 100644 --- a/lcl/include/taskdialog.inc +++ b/lcl/include/taskdialog.inc @@ -221,7 +221,7 @@ var TaskDlg: LCLTaskDialog.TTaskDialog; DefRB, DefBtn: TModalResult; B: TTaskDialogBaseButtonItem; - ButtonID: Integer; + ButtonID, ARadioRes: Integer; const TD_BTNMOD: array[TTaskDialogCommonButton] of Integer = ( mrOk, mrYes, mrNo, mrCancel, mrRetry, mrAbort); @@ -233,15 +233,14 @@ begin //temporary show new, then old dialog, both in emulated mode (regardless of Flags) LCLTaskDialog.TaskDialogIndirect := nil; - ButtonID := TWSTaskDialogClass(WidgetSetClass).Execute(Self); + ButtonID := TWSTaskDialogClass(WidgetSetClass).Execute(Self, ParentWnd, ARadioRes); FModalResult := ButtonIDToModalResult(ButtonID); Result := (ButtonID >= 0); debugln(['TWSTaskDialogClass(WidgetSetClass).Execute(Self)=',ButtonID,', Result=',Result]); debugln(['New: ButtonID=',ButtonID]); debugln(['New: FModalResult=',FModalResult]); debugln(['New: VerifyChecked=',tfVerificationFlagChecked in FFlags]); - //ToDo: we need to retrieve RadioResult, since we cannot set RadioButton (it's read only) - + debugln(['New: ARadioRes=',ARadioRes]); FillChar(TaskDlg, SizeOf(LCLTaskDialog.TTaskDialog), 0); if RadioButtons.DefaultButton<> nil then @@ -276,7 +275,7 @@ begin debugln(['Old: FModalResult=',FModalResult]); //ToDo move FirstButtonIndex and FirstRadioButtonIndex to interface section Dialogs unit. - + debugln(['Old: TaskDlg.RadioRes=',TaskDlg.RadioRes]); if (TaskDlg.RadioRes>=200) and (TaskDlg.RadioRes-200