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

# TOpenOption

Options which can be used in a TOpenDialog instance.

## Declaration

Source position: dialogs.pp line 186

`type TOpenOption = (`
`ofReadOnly,` |  | For the Windows platform (with ofOldStyleDialog or before Vista), it is responsible for the state of the "Read only" check box when opening the dialog and before closing it. The user can set this check box to ask the program to open a file in read-only mode. For QT-based platforms, it indicates that the entire dialog model is read-only.
`ofOverwritePrompt,` |  | If the selected file exists, a message is displayed to confirm rewriting the file.
`ofHideReadOnly,` |  | Windows only (with ofOldStyleDialog or before Vista): Hides the "Read only" check box on the dialog.
`ofNoChangeDir,` |  | Do not change the current directory.
`ofShowHelp,` |  | Show a help button.
`ofNoValidate,` |  | Windows only: Disables file name validation using OFN_NOVALIDATE/FOS_NOVALIDATE flags. Allows file names with invalid characters.
`ofAllowMultiSelect,` |  | Allows selection of multiple files (or folders). The selection list can be read in the Files property (FileName also contains the first file in the list). Affects the ofExtensionDifferent and ofCreatePrompt flags. Not available in TSaveDialog.
`ofExtensionDifferent,` |  | This is a returned flag that is set when the extension of the selected file differs from DefaultExt. It can only be returned when DefaultExt is not empty, and the dialog call was successful (Execute is true). For compatibility with Delphi, it is never set if multiple files are selected (possibly with ofAllowMultiSelect).
`ofPathMustExist,` |  | Prevents selection of a non-existent path. Depending on the widget set, the error will be displayed in the dialog itself or after it is closed, when Execute returns false.
`ofFileMustExist,` |  | Doesn't allow to select a non-existent file. Depending on the widget set, the error will be displayed in the dialog itself or after its closing, when Execute returns false.
`ofCreatePrompt,` |  | Windows only: Enables a verification prompt when a file or directory needs to be created for a file dialog. If the user decides to create a file, the dialog box closes. Otherwise, the dialog box remains open. When using ofAllowMultiSelect, it allows a single non-existing file to be specified.
`ofShareAware,` |  | Windows only: Ignore network sharing violation errors.

`ofNoReadOnlyReturn,`

Indicates that a dialog cannot be used to choose a read-only file. For the Windows platform, TOpenDialog displays an error message if a read-only file is selected - but it does not close the dialog. TSaveDialog will always display an error message if the user selects a read-only file - regardless of the state of this flag. For other platforms, TOpenDiaLog / TSaveDialog use the value to ensure that a file or directory selected with the dialog has write access permissions. A 'File is not writable' error message is displayed if the file or directory is read-only. See TOpenDialog.CheckFile.

`ofNoTestFileCreate,` |  | Windows only: The OS does not check if the item specified in a TSaveDialog can actually be created (it does not check for write protection, a full disk, an open drive door, or network protection).
`ofNoNetworkButton,` |  | Windows only: Hides and disables the "Network" button.
`ofNoLongNames,` |  | Windows only (with ofOldStyleDialog): Disables long file names and force use the 8.3 file names format.
`ofOldStyleDialog,` |  | Windows only: Shows the dialog in the Win9x style. In this style, an additional "Read only" check box for the file opening mode can be displayed (depending on ofReadOnly and ofHideReadOnly).
`ofNoDereferenceLinks,` |  | Windows only: When choosing a file shortcut (*.lnk), return the shortcut itself and not the target file.
`ofNoResolveLinks,` |  | Do not resolve links after Execute. This value is not explicitly used in any of the widgetset implementations.
`ofEnableIncludeNotify,` |  | Not used in the current LCL version. Defined for compatibility with Delphi.
`ofEnableSizing,` |  | Dialog can be resized, e.g. via the mouse.
`ofDontAddToRecent,` |  | Windows only: Do not add the path to the history list.
`ofForceShowHidden,` |  | Show hidden files.
`ofViewDetail,` |  | Indicates that the preview pane should be displayed on the Open dialog box. Used in gtk1, qt4, qt5, and qt6 widgetsets. Note: not implemented for gtk2 and gtk3.
`ofAutoPreview` |  | For Windows Vista (and later versions), indicates that the preview pane should always be displayed on an Open dialog box. Causes the FOS_FORCEPREVIEWPANEON flag to be included for a dialog using the Windows widgetset.
`);`

## Description

TOpenOption contains a list of possible options which can be used in Open or Save dialogs. Values from the enumeration are stored in the TOpenOptions set type which is used to implement the Options property in TOpenDialog and descendent classes. When an option value is included in the set, it is enabled during execution of the dialog. The values are applied to the native dialog before it is executed. Some option values are included or excluded to represent the actions performed when the native dialog was executed.

Please note that some option values may not be available for a given platform where the LCL is supported. The help for the option values indicate the platforms where the value is relevant.

## See also

TOpenDialog.Options |  | Options to be used for this dialog.
TOpenOptions |  | Set type used to store TOpenOption enumeration values.
TSaveDialog |  | TSaveDialog - Dialog for saving the current buffer to a file.
TSelectDirectoryDialog |  | Implements a select directory dialog.