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

# TOpenDialog

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a File / Open dialog used to select one or more files on the local file system.

## Declaration

Source position: dialogs.pp line 239

`type TOpenDialog = class(TFileDialog)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure ResolveLinks; virtual;` |  | Gets physical file names for symbolic links or file references.
`function CheckFile(); virtual;` |  | Ensures the specified file name meets the requirements for the dialog.
`function CheckFileMustExist(); virtual;` |  | Determines whether the specified file name exists.
`function CheckAllFiles; virtual;` |  | Ensures that values in the FileName and Files properties are valid for the Options in the dialog.
`function DoExecute; override;` |  | Performs actions needed to display the dialog and capture its result.
`function DefaultTitle; override;` |  | Gets the default title used for the Open Dialog.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`procedure DoCanClose(); override;` |  | Performs actions to determine if the dialog can be closed.
`procedure DoFolderChange; virtual;` |  | Signals the OnFolderChange event handler when a new directory is selected during execution of the dialog.
`procedure DoSelectionChange; virtual;` |  | Performs actions when the selected file in FileName has been changed.
`procedure IntfSetOption();` |  | Implements the callback used to update values in Options when the widgetset class processes the dialog result.
`published`
`property Options: TOpenOptions; [rw]` |  | Options to be used for this dialog.
`property OptionsEx: TOpenOptionsEx; [rw]` |  | Widgetset-specific options enabled for the dialog.
`property OnFolderChange: TNotifyEvent; [rw]` |  | Event signalled when a new directory is selected in the dialog.
`property OnSelectionChange: TNotifyEvent; [rw]` |  | Event triggered when the user changes the folder of file selection(s) made in the OpenDialog.
`end;`

## Inheritance

`TOpenDialog` |  | Implements a File / Open dialog used to select one or more files on the local file system.
`TFileDialog` |  | TFileDialog allows selection of a file from the current directory.
`TCommonDialog` |  | The base type from which other dialogs are derived.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TOpenDialog is a TFileDialog descendent which implements a dialog used to select one or more files that can be opened in an application. TOpenDialog is implemented as a wrapper for the native file selection dialogs on the various platforms / widgetsets.

Use the Options property to configure the features and behaviors enabled when the dialog is executed. Please note that some of the options are platform-specific, and may not be available on all of the platforms supported by the Lazarus LCL.

Use InitialDir to specify the directory with the files displayed when the dialog is executed.

Use the event handlers to perform actions needed when the directory or file selection(s) is changed during execution of the dialog.

Use the FileName or Files properties to access the file(s) selected using the dialog.

Use the Filter and FilterIndex properties to determine the file extensions displayed in the dialog. Use the OnTypeChange event handler to perform actions needed when the active filter is changed.

Use the UserChoice property to determine the button pressed to close the dialog.

## See also

TFileDialog |  | TFileDialog allows selection of a file from the current directory.