OpenDialog Class

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

Events

None

Properties

None

Methods

None

More information available in parent classes: FolderItemDialog:Object


Notes

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)


Example

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= Volume(0).Child("Documents")
#Else   //open Home directory on linux
 dlg.InitialDirectory= Volume(0).Child("home")
#endif
dlg.Title="Select a MIF file"
dlg.Filter=TextTypes.mif
f=dlg.ShowModal()
If f <> Nil then
 //proceed normally
 Else
 //User Cancelled
End if

See Also

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