OpenDialog

Qualified name: delphifmx.OpenDialog

class OpenDialog

Bases: FmxObject

TOpenDialog is a class used to display a file-selection dialog. Use TOpenDialog to display a dialog box for selecting and opening files. When the user clicks the Open button, the dialog closes and the selected files are stored in the Files property.

Note: The dialog does not appear at run time until it is activated by a call to the Execute method.

Methods

Execute

Displays the dialog

Attributes

ActionClient

Specifies whether the component object has an associated action.

Children

Stores an array of children attached to this parent component.

ChildrenCount

Read-only property that specifies the number of children in the children list.

ClassName

Returns the TObject.ClassName

ComObject

Specifies the interface reference implemented by the component.

ComponentCount

Returns the owned component count

ComponentIndex

Indicates the position of the component in its owner's Components property array.

ComponentState

Describes the current state of the component, indicating when a component needs to avoid certain actions.

ComponentStyle

Governs the behavior of the component.

Components

Returns an iterator over the owned components

Data

Stores a Tvalue, which is a data structure that can store different kinds of data types.

DefaultExt

Specifies a default file extension.

DesignInfo

Contains information used by the Form designer.

FileName

Files

Represents the list containing the absolute paths of the selected files.

Filter

Represents the file masks (filters) of the dialog.

FilterIndex

Determines which filter is selected by default when the dialog opens.

HelpContext

int:

HistoryList

Maintains a list of the previously selected files.

Index

Specifies the index of the child object in the children array attached to this object.

InitialDir

Determines which directory is selected by default when the dialog opens.

Name

Specifies the name of the component as referenced in code.

Observers

Indicates the TObservers object added to the TComponent.

OnCanClose

Callable[[Object, bool], None]:

Options

Determines the appearance and behavior of the file-selection dialog.

OptionsEx

Augments the Options property with additional flags that determine the appearance and behavior of the file selection dialog.

Owner

Returns the Component Owner

Parent

Returns/Sets the Control Visibility

Root

Specifies the root parent of this object.

Stored

Specifies whether this object is stored in the .XFM file.

StyleName

Specifies the style name for this FMX component.

Tag

Stores a NativeInt integral value as a part of a component.

TagFloat

Custom property that stores any floating-point value.

TagObject

Custom property that stores any object value.

TagString

Custom property that stores any string value.

Title

Specifies the text displayed in the dialog's title bar.

VCLComObject

Represents information used internally by components that support COM.

DefaultExt

Specifies a default file extension. DefaultExt specifies a file extension that is appended automatically to the selected file name, unless the selected file name already includes a registered extension. Extensions longer than three characters are not supported. Do not include the period (.) that separates the file name from the extension.

Type:

str

Execute()

Displays the dialog

Files

Represents the list containing the absolute paths of the selected files. Files represents a string list that contains the absolute path of each selected file.

Note: In order for the user to select multiple files, set the ofAllowMultiSelect flag in Options.

Type:

Strings

Filter

Represents the file masks (filters) of the dialog. The file-selection dialog includes a drop-down list of file types on the left of the ‘File Name:’ edit box. When the user picks a file type from the list, only files of the selected type are displayed in the dialog. You can select only one filter at a time. In order for Filter to work properly, the assigned string must be formatted as follows: ‘<first displayed name>|<first file extension>|<second displayed name>|<second file extension>|…|<n-th displayed name>|<n-th file extension>’ For example, the next code sample will add filters for text and executable files:

OpenDialog1.Filter:=’Applications (.exe)|.EXE|Text files (.txt)|.TXT’;

Type:

str

FilterIndex

Determines which filter is selected by default when the dialog opens. FilterIndex determines which of the file types in Filter is selected by default when the dialog opens. Set FilterIndex to 1 to choose the first file type in the list as default, 2 to choose the second file type as the default, and so on. If the value of FilterIndex is out of range, the last file type listed in Filter is selected by default.

Type:

int

HelpContext

int:

HistoryList

Maintains a list of the previously selected files. Obsolete property. HistoryList is maintained for compatibility with older versions of TOpenDialog. It is not used.

Type:

Strings

InitialDir

Determines which directory is selected by default when the dialog opens. InitialDir determines the default directory displayed in the file-selection dialog when it opens. If no value is assigned to InitialDir, or the specified directory does not exist, the initial directory is controlled by a special registry key assigned to your application.

Note: For Windows, the registry key can be found at HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32LastVisitedMRU.

Type:

str

OnCanClose

Callable[[Object, bool], None]:

Options

Determines the appearance and behavior of the file-selection dialog. Use the Options property to customize the appearance and functionality of the dialog.

Type:

OpenOptions

OptionsEx

Augments the Options property with additional flags that determine the appearance and behavior of the file selection dialog. Use the OptionsEx property to further customize the file open dialog beyond the options covered by the Options property.

Type:

OpenOptionsEx

Title

Specifies the text displayed in the dialog’s title bar. Use Title to set the text that appears in the file-selection dialog’s title bar. If no value is assigned to Title, the dialog’s title is “Open”.

Type:

str