SelectFolderDialog

From Xojo Documentation

Class (inherits from FolderItemDialog)

Used to create and present customized Select Folder dialog boxes. The non-customized version of this function is provided by the SelectFolder function.

Properties
ActionButtonCaption Left Title
CancelButtonCaption PromptText Top
Filter Result fa-lock-32.png
InitialFolder SuggestedFileName


Methods
ShowModal ShowModalWithin

Notes

Using the properties of the FolderItemDialog class, you can customize the following aspects of a select-folder 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 in the body of the dialog (PromptText property)

Examples

The following example opens a select folder dialog box and presents the contents of the "Documents" directory on the user's startup volume in the browser:

Var dlg As New SelectFolderDialog
dlg.ActionButtonCaption = "Select"
dlg.Title = "Title Property"
dlg.PromptText = "Prompt Text"
dlg.InitialFolder = SpecialFolder.Documents

Var f As FolderItem
f = dlg.ShowModal
If f <> Nil Then
// Use the folderitem here
Else
// User cancelled
End If

See Also

FileType, FolderItem, FolderItemDialog, OpenFileDialog, SaveAsDialog, classes; FolderItem.ShowSelectFolderDialog function.