FolderItemDialog

From Xojo Documentation
Jump to: navigation, search

Class (inherits from Object)

The base class for the OpenDialog, SaveAsDialog, and SelectFolderDialog classes, which allow you to create customized open, save, and select folder dialog boxes.


Properties
ActionButtonCaption Left Title
CancelButtonCaption PromptText Top
Filter Result ReadOnlyProperty.png
InitialDirectory SuggestedFileName


Methods
ShowModal ShowModalWithin


Notes

Not all properties are available for all three subclasses of FolderItemDialog and some properties are not supported on Windows.

The following table clarifies the situation.

Property Windows Windows Windows macOS macOS macOS Linux Linux Linux
OpenDialog SaveAsDialog SelectFolder OpenDialog SaveAsDialog SelectFolder OpenDialog SaveAsDialog SelectFolder
Top & Left
PromptText
Title
ActionButtonCaption
CancelButtonCaption
SuggestedFileName
Filter
InitialDirectory

Examples

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
#Endif
dlg.Title = "Select a MIF file"
dlg.Filter = FileTypes1.mif //Defined as file type in FileTypes1.
f = dlg.ShowModal
If f <> Nil Then
// proceed normally
Else
// User Cancelled
End If

The following example opens a customized save-file dialog box and displays the contents of the "Documents" directory in the browser area.

Dim dlg As New SaveAsDialog
Dim f As FolderItem
dlg.InitialDirectory = SpecialFolder.Documents
dlg.PromptText = "Prompt Text"
dlg.SuggestedFileName = "Suggested Filename"
dlg.Title = "Title Property"
dlg.Filter = FileTypes1.Text //defined as a file type in FileTypes1 File Type Set
f = dlg.ShowModal
If f <> Nil Then
// file saved
Else
//user canceled
End If

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

Dim dlg As New SelectFolderDialog
Dim f As FolderItem
dlg.ActionButtonCaption = "Select"
dlg.Title = "Title Property"
dlg.PromptText = "Prompt Text"
#If Not TargetLinux Then
dlg.InitialDirectory = SpecialFolder.Documents
#Else // open Home directory on linux
dlg.InitialDirectory = SpecialFolder.Home
#Endif
f = dlg.ShowModal
If f <> Nil Then
// use the folderitem here
Else
// user cancelled
End If

See Also

OpenDialog, SaveAsDialog, SelectFolderDialog classes.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About