FolderItemDialog
From Real Software Documentation
The base class for the OpenDialog, SaveAsDialog, and SelectFolderDialog classes, which allow you to create customized open, save, and select folder dialog boxes.
| Properties | ||||||||||
|
| Methods | ||
|
Notes
Not all properties are available for all three subclasses of FolderItemDialog and some properties are not supported on Windows. The descriptions for each of the three subclasses have illustrations of the dialogs on each of the three platforms (Windows, Mac OS X, and Linux).
The following table clarifies the situation.
| Property | Windows | Windows | Windows | Mac OS X | Mac OS X | Mac OS X | 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 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 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 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.
