From Xojo Documentation

Class (inherits from FolderItemDialog)

Creates a customizable Open-file dialog box. The non-customizable version of this dialog is displayed by the GetOpenFolderItem function.

ActionButtonCaption InitialDirectory Result fa-lock-32.png
CancelButtonCaption Left SuggestedFileName
Count MultiSelect Title
Filter PromptText Top

Item ShowModal ShowModalWithin


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 dlg As OpenDialog
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
//proceed normally
//User Cancelled
End If

See Also

FileType, FolderItem, FolderItemDialog, SaveAsDialog, SelectFolderDialog classes; GetOpenFolderItem function.