TaskDlg function
Provides a wrapper function used to configure and execute a TTaskDialog instance.
Declaration
function TaskDlg(const aCaption: string; const aMsg: string;
const aInfo: string; DlgIcon: TTaskDialogIcon;
AButtons: TMsgDlgButtons; const aFooter: string='';
const aDetails: string='';
AFlags: TTaskDialogFlags=[tfAllowDialogCancellation])
: TModalResult; overloadArguments
aCaption | Text displayed as the title bar caption on the task dialog form. |
aMsg | Text displayed as the header-like text in the body of the task dialog. |
aInfo | Text displayed in the main content area on the task dialog immediately after the header text in aMsg. |
DlgIcon | Indicates the icon displayed on the task dialog. |
AButtons | Set with the common buttons displayed on the task dialog. These buttons have a modal result value associated with the button, and can include values like mbOK, mbCancel, mbYes, mbNo, mbRetry, and mbClose. |
aFooter | Text displayed as the caption in the footer area on the task dialog. |
aDetails | Text displayed in an expandable text area on the task dialog. Include tfExpandedByDefault in Flags to automatically expand the text area in the main body of the task dialog. Include tfExpandFooterArea in Flags to place the detail text in the expandable footer area. |
AFlags | Set of features or behaviors enabled in task dialog. The default value is [tfAllowDialogCancellation] and allows the task dialog to be cancelled. |
Function result
TModalResult value returned when the task dialog is executed. The default value is mrCancel.
Description
TaskDlg is an overloaded function which implements a wrapper used to
execute a TTaskDialog with the specified parameter values. TaskDlg is a
convenience routine that allows a task dialog to be used in a manner similar to
the MessageDlg routine. The overloaded variants allow different features /
behaviors to be enabled when the task dialog is executed.
The parameter values are copied to the corresponding properties in the TTaskDialog instance created (and freed after execution) in the routine. The Execute method in the dialog is called to display the dialog form and to capture the result.
The return value is the TModalResult enumeration value returned in
the ModalResult property for the TTaskdialog instance. The default value is
mrCancel.
Use the Flags argument to indicate whether specific features are enabled (or disabled) when the task dialog is executed. See TTaskDialogFlag for the values allows in the Flags argument and their usage.
See TTaskDialog for more information about the features and behaviors supported in the dialog type.
For example:
var
IsChecked: boolean;
RadioResult: integer;
begin
TaskDlg('I am the caption', 'I am the message',
'Some text as information. Lorem ipsum foo bar.',
tdiInformation, [mbOk, mbCancel], ['Custom', 'Button', 'first'], 500,
'Checkbox text', IsChecked, ['radio 1', 'radio 2', 'radio default'],
RadioResult, 2 {0-based}, 'Example footer text',
{ Can be in body or footer }
'If there is need for more DETAILS, then the can be added here. ' +
'And can be controlled by tfExpandedByDefault, tfExpandFooterArea',
{ These have default text, rarely need to be changed }
'Click to see details', 'Click to hide details',
[tfAllowDialogCancellation {, tfExpandedByDefault, tfExpandFooterArea}]
);
end;
Please note that the TaskDlg wrapper does not provide access to all of the features / behaviors available in TTaskDialog. You must use a TTaskDialog instance to configure and enable those features when parameters are not provided in TaskDlg.
Added in LCL version 4.0.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
