[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'TaskDlgEmulation' (#lcl)

# TLCLTaskDialog.Execute

Configures and displays the emulated task dialog and returns the modal result value.

## Declaration

Source position: taskdlgemulation.pp line 173

`public function TLCLTaskDialog.Execute(`
`AParentWnd: HWND;`
`out ARadioRes: Integer`
`):Integer;`

## Arguments

`AParentWnd` |  | Handle for the form which is the parent for the dialog form, or 0 to use the active form on the screen.
`ARadioRes` |  | Returns the identifier for the selected radio button on the form, or 0 when not available.

## Function result

Modal result value captured when ShowModal is called for the dialog form, or -1 when the owner is not a TTaskDialog instance.

## Description

Execute is an Integer function used to configure, display, and capture the modal result value for the emulated task dialog. The return value contains the modal result for the button used to close the dialog form. No actions are performed in the method when the Owner of the form has not been assigned or is not a TTaskDialog instance. In this situation, the return value is -1.

Execute calls the SetupControls method to configure and layout the elements on the dialog form using the settings provided in the TTaskDialog instance.

AParentWnd contains the handle for the form that is used as the parent for the dialog form. The value is compared to the handles for the forms on the current Screen. When found, the form instance is assigned to the PopupParent property for the dialog form. When not found, the currently active form on the screen is used as the PopupParent.

Execute calls the ShowModal method (in TCustomForm) to manage modal display of the dialog form in the application, and to start the processing loop for the modal form. ShowModal sets the return value for the method.

When ShowModal has been completed, values from the updated form are applied to the TTaskDialog instance which created the dialog. This includes values like:

- The query result and query item index (when used).
- The value from the simple query control (when used).
- The verification check box state (when used).
- The identifier for the selected radio button returned in the ARadioRes argument.

## See also

TTaskDialog.Flags |  | Set of options enabled for the Task dialog.