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

# TOpenDialog.DoExecute

Performs actions needed to display the dialog and capture its result.

## Declaration

Source position: dialogs.pp line 267

`protected function TOpenDialog.DoExecute: Boolean; override;`

## Function result

True when the selected file(s) are valid and the method is successfully completed.

## Description

DoExecute is an overridden Boolean function in TOpenDialog. It ensures that the value ofExtensionDifferent is excluded from the Options property prior to executing the dialog. It calls the inherited method (in TCommonDialog) to display the dialog form and to get the UserChoice used to complete execution of the dialog.

DoExecute extends the execution loop for the dialog to use the Options enabled for the dialog, including:

ofNoResolveLinks
  Calls ResolveLinks to follow symbolic links when ofNoResolveLinks has been omitted.
ofNoChangeDir
  Updates the InitialDir property when a path in FileName or Files has been changed and ofNoChangeDir has been omitted.

The return value is True when all of the steps are successfully completed. The return value is False if any mechanism other than the OK button was used to close the dialog.

If execution of the inherited method was successfully completed, the CheckAllFiles method is called to validate the values in the FileName and Files properties.

The return value is set to True if the selected FileName or Files is/are valid for the dialog. Options is updated to exclude the value ofExtensionDifferent when Files contains more than 1 (one) file entry. This avoids the erratic behavior displayed when multiple file selections are enabled and used on the dialog, and mimics the behavior used in Delphi 7.

If a single file is selected on the dialog, and has an extension which does not match the assigned value in DefaultExt, the value ofExtensionDifferent is included in Options to indicate the condition.

DoExecute is called from the Execute method in the TCommonDialog ancestor, and occurs immediately before the Close method is called.

## See also

TOpenDialog.Options |  | Options to be used for this dialog.
TOpenDialog.CheckAllFiles |  | Ensures that values in the FileName and Files properties are valid for the Options in the dialog.
TOpenDialog.CheckFile |  | Ensures the specified file name meets the requirements for the dialog.
TOpenDialog.ResolveLinks |  | Gets physical file names for symbolic links or file references.
TFileDialog.FileName |  | Contains the UTF-8-encoded name for a file chosen using the dialog.
TFileDialog.Files |  | Stores the names of files (or directories) selected using the dialog.
TCommonDialog.DoExecute |  | The function that actually takes care of executing the dialog.
TCommonDialog.Execute |  | Displays the dialog and captures the result.
TOpenOption |  | Options which can be used in a TOpenDialog instance.
TOpenOptions |  | Set type used to store TOpenOption enumeration values.