TTaskDialog class
Implements a configurable modal task dialog.
Declaration
TTaskDialog = class(TCustomTaskDialog)Inheritance
- TTaskDialog
- TCustomTaskDialog
- TLCLComponent
TComponent
Description
TTaskDialog is a
TCustomTaskDialog descendant which
implements a configurable, modal task dialog. It can be used to display and
edit information on a dialog form with more features than those available on a
standard message box.
TTaskDialog sets the visibility for properties introduced in ancestor classes,
and provides a multi-platform implementation of the Windows TaskDialog API. It
provides properties which can be used to configure the task dialog at
design-time or at run-time. At run-time, the Execute method handles
converting properties and calling routines and methods in the widgetset which
implement the task dialog for a given platform.
Platform Support
The TaskDialog API, upon which TTaskDialog is based, is available only on
Windows Vista or later versions. On these platforms, the form displayed at
run-time is the native form for the platform. On older Windows versions, and
other platforms, the TaskDialog API is not available or supported. For these
platforms, a standard LCL form is created and populated at run-time to emulate
the appearance and behaviors for the Windows implementation. This occurs in the
widget set class and uses the components found in the
taskdlgemulation.pp unit. It can be forced by including a value in
the Flags property for the class instance.
Using TTaskDialog at Run-time.
procedure TForm1.Button1Click(Sender: TObject);
var ATaskDialog: TTaskDialog; // requires Dialogs in uses clause
begin
ATaskDialog := TTaskDialog.Create(Self);
with ATaskDialog do
begin
Caption := 'Let''s do this...';
MainIcon := tdiShield;
Title := 'Task Title';
Text := 'This tells the user the purpose for the dialog. ' +
'Please read and accept the Terms of Service. '+#10+#10+
'Some users prefer a little conversation before they will agree. ' +
'Along with a progress bar. Please tell us your level of interest.';
RadioButtons.Clear;
RadioButtons.Add.Caption := 'Low';
RadioButtons.Add.Caption := 'Medium';
RadioButtons.Add.Caption := 'High';
CommonButtons := [tcbOk,tcbCancel,tcbRetry];
ExpandedText := 'The Terms of Service grants a waiver of responsibility '+
'to Acme Corporation LLC for any insane acts a Coyote might perform '+
'using products or services provided by the Corporation.'+#10+#10+
'There is no legal venue where the Corporation is responsible. ' +
'Especially Albuquerque, NM USA. ' +#10+#10+
'Buyer beware. All rights reserved. Shipping fees and taxes may apply.';
VerificationText := 'I agree to everything.';
FooterIcon := tdiWarning;
FooterText := 'This is your <a href="#terminus">final</a> warning.';
Flags := [tfEnableHyperlinks, tfAllowDialogCancellation,
tfExpandedByDefault, tfVerificationFlagChecked];
if Execute then ; // do something based on ModalResult
Free;
end;
end;See also
Properties
Buttons | published | Collection with the buttons for the Task dialog. |
Caption | published | Caption text displayed on the title bar for the Task dialog. |
CommonButtons | published | Set of common buttons displayed on the Task dialog. |
CollapseButtonCaption | published | Caption text for the "expando" button on the task dialog. |
CustomFooterIcon | published | Contains a custom icon displayed in the footer area on the dialog. |
CustomMainIcon | published | Contains a custom icon displayed in the main content area on the dialog. |
DefaultButton | published | Index of the default button, from the set in the CommonButtons property. |
ExpandButtonCaption | published | Caption displayed for the expand/collapse button on the dialog. |
ExpandedText | published | Text that is displayed in the expandable / collapsible area on the Task dialog. |
Flags | published | Set of options enabled for the Task dialog. |
FooterIcon | published | Icon for the footer area displayed at the bottom of the dialog. |
FooterText | published | Text that is displayed in the footer area on the Task dialog. |
MainIcon | published | Icon displayed beside the Title for the dialog. |
ProgressBar | published | Contains information used to configure and update a progress bar enabled on the task dialog. |
RadioButtons | published | Collection with the optional radio buttons defined for the Task dialog. |
QueryChoices | published | Predefined values for the query control on the task dialog. |
QueryItemIndex | published | Ordinal position for the value in QueryChoices selected when the task dialog is executed. |
SimpleQuery | published | Contains the text displayed and edited using the query control on the task dialog. |
SimpleQueryPasswordChar | published | Character value used to obfuscate text in SimpleQuery for the query control. |
Text | published | Text displayed as main content for the Task dialog. |
Title | published | Text displayed at the top of dialog adjacent to the main icon. |
VerificationText | published | Optional caption for the verification check box displayed near the bottom of the Task dialog. |
Width | published | Sets the width in pixels for the task dialog form. |
Events
OnButtonClicked | published | Event handler signalled for the button clicked when the Task dialog was executed. |
OnDialogConstructed | published | Event handler signalled when the constructor for the dialog form instance has completed. |
OnDialogCreated | published | Event handler signalled when a form instance has been created for the dialog. |
OnDialogDestroyed | published | Event handler signalled when the task dialog form has been freed for the class instance. |
OnVerificationClicked | published | Event handler signalled when the verification check box has been clicked on the task dialog. |
OnExpanded | published | Event handler signalled when the ExpandedText on the dialog has been expanded or collapsed. |
OnTimer | published | Event handler signalled when the interval for the timer on the dialog has elapsed. |
OnRadioButtonClicked | published | Event handler signalled when a radio button on the dialog has been clicked. |
OnHyperlinkClicked | published | Event handler signalled when a hyperlink in one of the text areas has been clicked. |
Inherited
From TCustomTaskDialog (28)
Button ButtonIDToModalResult Create Destroy DoExecute DoOnButtonClicked DoOnDialogConstructed DoOnDialogCreated DoOnDialogDestroyed DoOnExpandButtonClicked DoOnHelp DoOnHyperlinkClicked DoOnNavigated DoOnRadioButtonClicked DoOnTimer DoOnVerificationClicked Execute Expanded Handle InternalSetDialogHandle ModalResult OnHelp OnNavigated QueryResult RadioButton SetRadioButtonFromRadioIndex URL WSRegisterClass
From TLCLComponent (7)
DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance RemoveAllHandlersOfObject WidgetSetClass
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
