DIALOG_PICKFILE

The DIALOG_PICKFILE function allows the user to i nteractively pick a file using the platform's own native graphical file-selection dialog. The user can also enter the name of a file that does not exist (see the description of the WRITE keyword, below). DIALOG_PICKFILE returns a string that contains the full path name of the selected file. If no file is selected, DIALOG_PICKFILE returns a null string.

Calling Sequence

Result = DIALOG_PICKFILE()

Keywords

DIRECTORY

Set this keyword to display only the existing directories in the current directory. Individual files are not displayed.

DISPLAY_NAME

Set this keyword equal to a string that specifies the name of the X Windows display on which the dialog should be displayed. This keyword is ignored on Microsoft Windows and Macintosh platforms.

FILE

Set this keyword to a scalar string that contains the name of the initial file selection. This keyword is useful for specifying a default filename.

FILTER

A string value for filtering the files in the file list. This keyword is used to reduce the number of files to choose from. The user can modify the filter unless the FIX_FILTER keyword is set. Example filter values could be '*.pro' or '*.dat' . Only a single filter condition is allowed.

Under Microsoft Windows, the user cannot modify the filter. (The user can, however, enter a filter string in the filename field to filter the files displayed.)

On the Macintosh, the filter is not displayed if the WRITE keyword is set.

FIX_FILTER

When this keyword is set, only files that satisfy the filter can be selected. The user has no ability to modify the filter and the filter is not shown.

Under Microsoft Windows, the user cannot modify the filter even if FIX_FILTER is not set. Note that the user can enter a filter string in the filename field of the dialog to change the filter condition even if FIX_FILTER is set.

GET_PATH

Set this keyword to a named variable in which the path of the selection is returned.

GROUP

The widget ID of a widget that calls DIALOG_PICKFILE. When this ID is specified, a death of the caller results in the death of the DIALOG_PICKFILE dialog.

MUST_EXIST

Set this keyword to allow only files that already exist to be selected.

PATH

Set this keyword to a string that contains the initial path from which to select files. If this keyword is not set, the current working directory is used.

READ

Set this keyword to make the title of the dialog "Select File to Read".

TITLE

Set this keyword to a scalar string to be used for the dialog title. If it is not specified, the default title is "Select File". This keyword is ignored on Macintosh platforms.

WRITE

Set this keyword to make the title of the dialog "Select File to Write".

Example

Create a DIALOG_PICKFILE dialog that lets users select only files with the extension `pro'. Use the `Select File to Read' title and store the name of the selected file in the variable file . Enter:

file = DIALOG_PICKFILE(/READ, FILTER = '*.pro')

See Also

FILEPATH