[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Dialogs' (#lcl)

TCustomTaskDialog.Execute

Displays the task dialog and captures the modal result value.

Declaration

Source position: dialogs.pp line 799

public function TCustomTaskDialog.Execute: Boolean; dynamic; overload;

function TCustomTaskDialog.Execute(

  ParentWnd: HWND

):Boolean; dynamic; overload;

Function result

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

Arguments

ParentWnd

  

Parent window handle used to position the dialog in the LCLTaskDialog wrapper.

Description

Execute is an overloaded Boolean function used to display the dialog and capture the value for the ModalResult property. The parameterless variant is normally called to display and execute the dialog form. It gets the handle for the active form which is used as the parent for the task dialog form from the Screen singleton. If a TCustomForm has not been assigned in Screen, the unassigned handle value (0) is used. The overloaded variant is called using the handle value as an argument.

Execute calls the DoExecute method to perform actions needed to initialize and display the dialog form. It also processes return values used in properties like ModalResult, QueryResult, QueryItemIndex, Button, and RadioButton.

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

Remark: 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

TCustomTaskDialog.DoExecute

  

Performs actions to configure and execute the dialog.

TCustomTaskDialog.ModalResult

  

Modal result value returned when the Task dialog was executed.

TCustomTaskDialog.Button

  

Not used in the current LCL version.

TCustomTaskDialog.RadioButton

  

The radio button selected on the Task dialog.

TCustomTaskDialog.QueryResult

  

String representation for the query entered or selected on the dialog form.

TCustomTaskDialog.QueryItemIndex

  

Ordinal position for the value in QueryChoices selected when the task dialog is executed.

TTaskDialog

  

Implements a task dialog.


Version 4.0 Generated 2025-05-03 Home