diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp index f7bd3e71e8..e0f4c471b0 100644 --- a/lcl/dialogs.pp +++ b/lcl/dialogs.pp @@ -635,6 +635,10 @@ type FFooterText: TTranslateString; FMainIcon: TTaskDialogIcon; FModalResult: TModalResult; + FOnDialogConstructed: TNotifyEvent; + FOnDialogCreated: TNotifyEvent; + FOnDialogDestroyed: TNotifyEvent; + FOnVerificationClicked: TNotifyEvent; FQueryChoices: TStrings; FQueryResult: String; FQueryItemIndex: Integer; @@ -685,6 +689,10 @@ type property VerificationText: TTranslateString read FVerificationText write FVerificationText; property Width: Integer read FWidth write FWidth default 0; property OnButtonClicked: TTaskDlgClickEvent read FOnButtonClicked write FOnButtonClicked; + property OnDialogConstructed: TNotifyEvent read FOnDialogConstructed write FOnDialogConstructed; + property OnDialogCreated: TNotifyEvent read FOnDialogCreated write FOnDialogCreated; + property OnDialogDestroyed: TNotifyEvent read FOnDialogDestroyed write FOnDialogDestroyed; + property OnVerificationClicked: TNotifyEvent read FOnVerificationClicked write FOnVerificationClicked; end; TTaskDialog = class(TCustomTaskDialog) @@ -709,6 +717,10 @@ type property VerificationText; property Width; property OnButtonClicked; + property OnDialogConstructed; + property OnDialogCreated; + property OnDialogDestroyed; + property OnVerificationClicked; end; const diff --git a/lcl/interfaces/win32/win32wsdialogs.pp b/lcl/interfaces/win32/win32wsdialogs.pp index a941a2a0bc..293b78ba65 100644 --- a/lcl/interfaces/win32/win32wsdialogs.pp +++ b/lcl/interfaces/win32/win32wsdialogs.pp @@ -1660,9 +1660,27 @@ var Dlg: TTaskDialog absolute dwRefData; begin Result := S_OK; case uNotification of + TDN_DIALOG_CONSTRUCTED: + begin + Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog'); + if Assigned(Dlg.OnDialogConstructed) then + Dlg.OnDialogConstructed(Dlg); + end; + TDN_CREATED: + begin + Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog'); + if Assigned(Dlg.OnDialogCreated) then + Dlg.OnDialogCreated(Dlg); + end; + TDN_DESTROYED: + begin + Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog'); + if Assigned(Dlg.OnDialogDestroyed) then + Dlg.OnDialogDestroyed(Dlg); + end; TDN_BUTTON_CLICKED: begin - Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog'); + Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog'); if Assigned(Dlg.OnButtonClicked) then begin CanClose := True; @@ -1671,6 +1689,28 @@ begin Result := S_FALSE; end; end; + TDN_HYPERLINK_CLICKED: + begin + if IsConsole then writeln('ToDo: implement OnHyperlinkClicked'); + end; + TDN_NAVIGATED: + begin + if IsConsole then writeln('ToDo: implement TDN_NAVIGATED??'); + end; + TDN_TIMER: + begin + if IsConsole then writeln('ToDo: implement OnTimer'); + end; + TDN_VERIFICATION_CLICKED: + begin + Assert((Dlg is TCustomTaskDialog),'TaskDialogCallbackProc: dwRefData is NOT a TCustomTaskDialog'); + if Assigned(Dlg.OnVerificationClicked) then + Dlg.OnVerificationClicked(Dlg); + end; + TDN_EXPANDO_BUTTON_CLICKED: + begin + if IsConsole then writeln('ToDo: implement OnExpanded'); + end; end; end; diff --git a/lcl/taskdlgemulation.pp b/lcl/taskdlgemulation.pp index e0928db193..b3376fa4b7 100644 --- a/lcl/taskdlgemulation.pp +++ b/lcl/taskdlgemulation.pp @@ -54,6 +54,11 @@ type procedure AddQueryCombo(var X,Y: Integer; AWidth: Integer; AParent: TWinControl); procedure AddQueryEdit(var X,Y: Integer; AWidth: Integer; AParent: TWinControl); + procedure DoDialogConstructed; + procedure DoDialogCreated; + procedure DoDialogDestroyed; + procedure VerifyClicked(Sender: TObject); + protected procedure HandleEmulatedButtonClicked(Sender: TObject); procedure SetupControls; @@ -62,6 +67,8 @@ type constructor CreateNew(AOwner: TComponent; Num: Integer = 0); override; destructor Destroy; override; + procedure AfterConstruction; override; + function Execute(AParentWnd: HWND; out ARadioRes: Integer): Integer; public @@ -240,13 +247,21 @@ begin FDlg := TTaskDialog(AOwner); RadioButtonArray := nil; KeyPreview := True; + DoDialogCreated; end; destructor TLCLTaskDialog.Destroy; begin + DoDialogDestroyed; inherited Destroy; end; +procedure TLCLTaskDialog.AfterConstruction; +begin + inherited AfterConstruction; + DoDialogConstructed; +end; + function TLCLTaskDialog.Execute(AParentWnd: HWND; out ARadioRes: Integer): Integer; var mRes, I: Integer; @@ -500,6 +515,7 @@ begin SetBounds(X,Y,XB-X,24); Caption := VerificationText; Checked := FVerifyChecked; + OnClick := @VerifyClicked; end; end; inc(Y,36); @@ -626,6 +642,31 @@ begin inc(Y,42); end; +procedure TLCLTaskDialog.DoDialogConstructed; +begin + if Assigned(FDlg.OnDialogConstructed) then + FDlg.OnDialogDestroyed(FDlg); +end; + +procedure TLCLTaskDialog.DoDialogCreated; +begin + if Assigned(FDlg.OnDialogCreated) then + FDlg.OnDialogCreated(FDlg); +end; + +procedure TLCLTaskDialog.DoDialogDestroyed; +begin + if Assigned(FDlg.OnDialogDestroyed) then + FDlg.OnDialogDestroyed(FDlg); +end; + +procedure TLCLTaskDialog.VerifyClicked(Sender: TObject); +begin + if Assigned(FDlg.OnVerificationClicked) then + FDlg.OnVerificationClicked(FDlg); +end; + + procedure TLCLTaskDialog.HandleEmulatedButtonClicked(Sender: TObject); var Btn: TButton absolute Sender; CanClose: Boolean;