Previous - dlgColorBox Section Home - System Standard Dialogs Next - dlgFolder


dlgFile ( )

Displays a standard windows file selection dialog box.

Usage:

dlgFile (object me, integer dlgType, string folderPath, string fileName, string filter, string defaultExtension )

Parameters:

dlgType (integer) - the possible dialog types and values are:

  1. Save dialog box
  2. Open dialog box

folderPath (string) - string specifying the path to an existing folder

fileName (string) - name of the file with extension

filter (string) - Used in the drop down to filter file extensions. All filters are divided into pairs. Use the | character for separating the filter arguments. Use the semi-colon (;) to seperate multiple file extensions.

defaultExtension (string) - append this extension to the file name if the user fails to type an extension. This string can be any length, but only the first three characters are appended. The string should not contain a period (.).

Returns:

(string) - if the user selects a valid file, the file path is returned
(integer) - negative integer is returned is the user cancels the dialog box

Example:

-- asks user to select an image file, and import into memory
xtRose = xtra("Rosetta").new( )
strPath = xtRose.dlgFile( 2, "C:\windows\", "winnt.bmp", "Bitmap (*.bmp)|*.BMP|Portable Network Graphic (*.png)|*.PNG|Jpeg (*.jpg)|*.JPG|ICON (*.ico)|*.ICO"|All Image formats|*.bmp;*..png;*.jpg;*.jpeg;*.ico", "bmp" ) )
If ( STRINGP(strPath) = TRUE ) Then
  xtRose.imgOpen( "C:\windows\winnt.bmp" )
Else
  alert "Please select a valid image file"
End If

Notes:


Previous - dlgColorBox Section Home - System Standard Dialogs Next - dlgFolder