PeterPanettone 157 Posted February 27 (edited) I am trying to encapsulate the TaskDialog properties, its execution, and its result in a single unit: unit MyTaskDialogDNSAExpandable; interface uses Vcl.Dialogs, Winapi.Windows, Vcl.Controls; type TDialogResultWithDNSA = record ModalResult: Integer; DoNotShowAgain: Boolean; end; function ShowTaskDialogWithDNSAAndInfoText(const ATitle, AContent, ADNSACaption, AInfoText: string): TDialogResultWithDNSA; implementation function ShowTaskDialogWithDNSAAndInfoText(const ATitle, AContent, ADNSACaption, AInfoText: string): TDialogResultWithDNSA; var TaskDialog: TTaskDialog; begin TaskDialog := TTaskDialog.Create(nil); try TaskDialog.Caption := ATitle; TaskDialog.Text := AContent; TaskDialog.CommonButtons := [tcbOk, tcbCancel]; TaskDialog.VerificationText := ADNSACaption; TaskDialog.ExpandedText := AInfoText; TaskDialog.Flags := [tfUseCommandLinks, tfAllowDialogCancellation, tfExpandFooterArea]; // Execute the task dialog if TaskDialog.Execute then begin Result.ModalResult := TaskDialog.ModalResult; Result.DoNotShowAgain := ??? // how can I get the DoNotShowAgain state of the TaskDialog end else begin Result.ModalResult := mrCancel; Result.DoNotShowAgain := False; end; finally TaskDialog.Free; end; end; end. But how can I get the DoNotShowAgain state of the TaskDialog in Delphi 12? Edited February 27 by PeterPanettone Share this post Link to post
Remy Lebeau 1394 Posted February 27 (edited) Look for the tfVerificationFlagChecked flag in the TTaskDialog.Flags property after TTaskDialog.Execute() returns true: if TaskDialog.Execute then begin ... Result.DoNotShowAgain := tfVerificationFlagChecked in TaskDialog.Flags; ... end And, if you want the checkbox to be initially checked when you display the dialog, enable the tfVerificationFlagChecked flag before calling TTaskDialog.Execute(): TaskDialog.Flags := [tfUseCommandLinks, tfAllowDialogCancellation, tfExpandFooterArea]; if DoNotShowAgainIsChecked then TaskDialog.Flags := TaskDialog.Flags + [tfVerificationFlagChecked]; Edited February 27 by Remy Lebeau 1 3 Share this post Link to post