Sign in Join
FPDoc Onlineexperiment

TOpenOption enumeration

In unit Dialogs

Options which can be used in a TOpenDialog instance.

Declaration

pascal
TOpenOption = (ofReadOnly,ofOverwritePrompt,ofHideReadOnly,
 ofNoChangeDir,ofShowHelp,ofNoValidate,ofAllowMultiSelect,
 ofExtensionDifferent,ofPathMustExist,ofFileMustExist,
 ofCreatePrompt,ofShareAware,ofNoReadOnlyReturn,
 ofNoTestFileCreate,ofNoNetworkButton,ofNoLongNames,
 ofOldStyleDialog,ofNoDereferenceLinks,ofNoResolveLinks,
 ofEnableIncludeNotify,ofEnableSizing,ofDontAddToRecent,
 ofForceShowHidden,ofViewDetail,ofAutoPreview)

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

Values

ofReadOnlyFor 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
ofOverwritePromptIf the selected file exists, a message is displayed to confirm rewriting the file.
ofHideReadOnlyWindows only (with ofOldStyleDialog or before Vista): Hides the "Read only" check box on the dialog.
ofNoChangeDirDo not change the current directory.
ofShowHelpShow a help button.
ofNoValidateWindows only: Disables file name validation using OFN_NOVALIDATE/ FOS_NOVALIDATE flags. Allows file names with invalid characters.
ofAllowMultiSelectAllows 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.
ofExtensionDifferentThis 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 wi
ofPathMustExistPrevents 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.
ofFileMustExistDoesn'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.
ofCreatePromptWindows 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.
ofShareAwareWindows only: Ignore network sharing violation errors.
ofNoReadOnlyReturnIndicates 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
ofNoTestFileCreateWindows 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).
ofNoNetworkButtonWindows only: Hides and disables the "Network" button.
ofNoLongNamesWindows only (with ofOldStyleDialog): Disables long file names and force use the 8.3 file names format.
ofOldStyleDialogWindows 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).
ofNoDereferenceLinksWindows only: When choosing a file shortcut (*.lnk), return the shortcut itself and not the target file.
ofNoResolveLinksDo not resolve links after Execute. This value is not explicitly used in any of the widgetset implementations.
ofEnableIncludeNotifyNot used in the current LCL version. Defined for compatibility with Delphi.
ofEnableSizingDialog can be resized, e.g. via the mouse.
ofDontAddToRecentWindows only: Do not add the path to the history list.
ofForceShowHiddenShow hidden files.
ofViewDetailIndicates 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.
ofAutoPreviewFor 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.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.