Sign in Join
FPDoc Onlineexperiment

TCustomTaskDialog.DoExecute function

Member of TCustomTaskDialogprotectedIn unit Dialogs

Performs actions to configure and execute the dialog.

Declaration

pascal
function DoExecute(ParentWnd: HWND): Boolean; dynamic

Arguments

ParentWnd

Handle for the Parent Window of the dialog.

Function result

True if a valid button identifier was clicked in the dialog.

Description

DoExecute is a Boolean function used to initialize and execute the task dialog form. It is called from the Execute method and uses the handle in ParentWnd as the parent form for the task dialog.

DoExecute sets the default values for properties used as return values for the dialog like ModalResult (mrNone) and QueryResult (''). It calls the Execute method in the widgetset class instance to perform the actions needed for the platform. On Windows Vista and later versions, this causes the native routines in the Win32 Task Dialog API to be called. For other platforms, including Windows versions prior to Vista, the emulated task dialog in TLCLTaskDialog is used in the widget.

Use the Flags property to specify which features or behaviors are enabled on the task dialog form.

DoExecute captures various return values from the widgetset class. These include:

  • The button identifier used to close the dialog form.
  • The modal result value for the button identifier used to close the form.
  • The optional radio button selected on the dialog.
  • The value from a query control on the dialog and its index position in the query choices.

The return value is False if the button identifier returned from the widget is a negative value. The return value is True if the dialog form was successfully displayed, and a valid button identifier was used to close the form - including when Esc, Alt+F4 or the Cancel button is used.

This behavior is different than other LCL dialogs where a ModalResult of mrCancel would cause Execute / DoExecute to return False. This is consistent with the task dialog behavior in the Delphi VCL; the Delphi documentation states otherwise but it is incorrect.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.