From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
| This item was deprecated in version 2019r2.
Please use OpenFileDialog as a replacement.
Supported PlatformsProject Types: Desktop Platforms: macOS, Windows, Linux
Creates a customizable Open-file dialog box. The non-customizable version of this dialog is displayed by the GetOpenFolderItem function.
Using the properties of the FolderItemDialog class, you can customize the following aspects of an open-file dialog box:
- Position (Left and Top properties)
- Default directory (Initial Directory property)
- Valid file types to show (Filter property)
- Text of the Validate and Cancel buttons (ActionButtonCaption and CancelButtonCaption properties)
- Text that appears in the Title bar of the dialog (Title property)
- Text that appears inside the dialog (PromptText property)
The following code opens a customizable open-file dialog box and presents the Documents or Home directory in the file browser. Only MIF files are listed. The file type passed to the Filter parameter was previously defined in a File Type Set called "TextTypes" in the File Type Sets Editor or via the FileType class.
Dim f As FolderItem
dlg = New OpenDialog
#If Not TargetLinux Then
dlg.InitialDirectory = SpecialFolder.Documents
#Else //open Home directory on linux
dlg.InitialDirectory = SpecialFolder.Home
dlg.Title = "Select a Text file"
dlg.Filter = FileTypes1.Text // "text/plain" file type defined in FileTypes1 set
f = dlg.ShowModal
If f <> Nil Then