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

# TCustomTaskDialog.ButtonIDToModalResult

Gets the modal result value for the button with the specified identifier.

## Declaration

Source position: dialogs.pp line 798

`public function TCustomTaskDialog.ButtonIDToModalResult(`
`const AButtonID: Integer`
`):TModalResult;`

## Arguments

`AButtonID` |  | Numeric identifier for the button with the modal result value returned in the method.

## Function result

Modal result value for the button with the specified identifier.

## Description

ButtonIDToModalResult is a TModalResult function used to get the modal result value for the button with the identifier specified in the AButtonID argument.

AButtonID contains one of the button identifier constants which correspond to the standard Buttons used on the task dialog, including:

- IDOK
- IDCANCEL
- IDABORT
- IDRETRY
- IDIGNORE
- IDYES
- IDNO
- IDCLOSE

If AButtonID is in the range of button identifiers starting at TaskDialogFirstButtonIndex, but is not found in Buttons, the value in AButtonID is used in the return value. If the identifier is valid for and found in Buttons, the return value is set to one the modal result constants like:

- mrOK
- mrCancel
- mrAbort
- mrRetry
- mrIgnore
- mrYes
- mrNo
- mrClose
- mrNone

The return value is set to mrNone if AButtonID is not valid for or not found in the Buttons collection.

ButtonIDToModalResult is called from the DoExecute method using the button identifier returned from the Execute method in the widgetset class instance.

## See also

TCustomTaskDialog.Buttons |  | Collection with the buttons for the Task dialog.
TaskDialogFirstButtonIndex |  | Lowest index value for a button identifier used on a task dialog instance.
TTaskDialogButtons |  | Collection type used to access and maintain buttons defined for a Task dialog.
TTaskDialogBaseButtonItem.ModalResult |  | Modal result value returned when the button is clicked.
TModalResult |  | Dummy type for the values that can be returned as a modal result.