Options Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Specifies a collection of flags that affect the dialog’s appearance and behavior.

Declaration

componentObj.Options
Read-Write Property String
componentObj     One of the user forms components listed in the Applies To section  

Applies To

The property applies to the following components:

TOpenDialog, TSaveDialog

Description

The Options property provides access to a collection of flags that determine the dialog's look and response to user actions.

Property Value

A string containing the dialog flag values separated by spaces or commas and optionally enclosed in square brackets. The property value is the combination of the following values:

Value Description
ofAllowMultiSelect Lets users to choose several files in the dialog.
ofCreatePrompt Specifies whether the dialog will ask the user to confirm creating a file if the user entered a new file name. (Applies to TSaveDialog.)
ofDontAddToRecent The file(s) selected in the dialog will not be added to a list of recently opened files.
ofEnableIncludeNotify (Windows XP and later.) Sends CDN_INCLUDEITEM notification messages to the dialog when the user opens a folder. A notification is sent for each item in the newly opened folder. You can use these messages to control which items appear in the folder’s item list.
ofEnableSizing Allows the Explorer-style dialog be resized with the mouse or keyboard. By default, the dialog allows this resizing regardless of the value of this option. It is only required if you provide a hook procedure or custom template. (Old style dialogs never permit resizing.)
ofExtensionDifferent Indicates whether the file that was selected in the dialog has the extension different from the DefaultExt.
ofFileMustExist Defines whether to show an error when the user tries to select a file name with a nonexistent file. (Applies to TOpenDialog.)
ofForceShowHidden Defines whether to show hidden files regardless the system settings.
ofHideReadOnly Shows the Open As Read Only checkbox. (Applies to TOpenDialog.)
ofNoChangeDir Resets the current directory to InitialDir when the dialog is closed.
ofNoDereferenceLinks Disables de-referencing of Windows shortcuts. If the user selects a shortcut, assigns to FileName the path and file name of the shortcut itself (the .LNK file), rather than the file linked to the shortcut.
ofNoLongNames Displays only files with 8.3-character format names. Applies only if the ofOldStyleDialog option is enabled.
ofNoNetworkButton Removes the Network button (which opens a Map Network Drive dialog) from the file-selection dialog. Applies only if the ofOldStyleDialog option is enabled.
ofNoReadOnlyReturn Defines whether to show an error when the user tries to select a read-only file.
ofNoTestFileCreate Disables checking for network file protection and inaccessibility of disk drives. Applies only when the user tries to save a file in a create-no-modify shared network directory.
ofNoValidate Disables checking for invalid characters in file names. Allows selection of file names with invalid characters.
ofOldStyleDialog The file-selection dialog is shown in Windows 95 style.
ofOverwritePrompt Defines whether to show a warning when trying to save to the existing file. (Applies to TSaveDialog.)
ofPathMustExist Defines whether to show an error when the user tries to select a file name with a nonexistent directory path.
ofReadOnly Enables the Open As Read Only checkbox. The checkbox is visible if the ofHideReadOnly is disabled. (Applies to TOpenDialog.)
ofShareAware Ignores sharing errors and allows files to be selected even when sharing violations occur.
ofShowHelp Displays the Help button.

By default, the Options property is a combination of ofHideReadOnly and ofEnableSizing.

When setting the Options property from the User Forms Editor, you should set the needed property flags of the Options property to True and other flags to False.

When you obtain the value of the Options property from scripts, the values are separated by commas. For example, if options were not changed, the Options property will return “ofHideReadOnly,ofEnableSizing”.

When you set the Options property value from scripts, you should separate values by commas or spaces and you can optionally enclose the string in square brackets. For example, all of the following variants are equivalent and valid:

UserForms.MyForm.TOpenDialog.Options = "ofAllowMultiSelect,ofNoChangeDir";
UserForms.MyForm.TOpenDialog.Options = "ofAllowMultiSelect ofNoChangeDir";
UserForms.MyForm.TOpenDialog.Options = "ofAllowMultiSelect, ofNoChangeDir";
UserForms.MyForm.TOpenDialog.Options = "[ofAllowMultiSelect,ofNoChangeDir]";
UserForms.MyForm.TOpenDialog.Options = "[ofAllowMultiSelect ofNoChangeDir]";
UserForms.MyForm.TOpenDialog.Options = "[ofAllowMultiSelect, ofNoChangeDir]";

See Also

OptionsEx Property

Highlight search results