From Xojo Documentation
Supported PlatformsProject Types: Desktop Platforms: macOS, Windows, Linux
New in 2019r2
Creates a customizable Open-file dialog box. The non-customizable version of this dialog is displayed by the FolderItem.ShowOpenFileDialog 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.
Var f As FolderItem
dlg = New OpenFileDialog
#If Not TargetLinux Then
dlg.InitialFolder = SpecialFolder.Documents
#Else //open Home directory on linux
dlg.InitialFolder = 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