@FILEDLG

Top  Previous  Next

Syntax:

 

@FILEDLG(<file description> <title>, <initial filename> {,<styles>})

 

Description:

 

This function displays a Windows common file dialog, and returns the name of the file that was selected (or a null string if no file was selected.) The string <file description> contains a filter for the file type to be displayed, for example: *.txt. The string <title> contains an optional title which will be used for the dialog. The string <initial filename> specifies an optional default filename.

The optional styles are:

MULTI

Allows multiple selections to be made. In this event, the files are returned as a string of names separated by carriage return characters. The resulting string can be assigned to a list using LIST ASSIGN, so each filename will then be a separate list item.

SAVE

Creates a dialog with a Save button instead of an Open button. These options are mutually exclusive: you cannot select multiple files to save.

Note that if the third parameter (default filename) is specified it must be a valid filename or mask such as "*.*". If it is not the file dialog box is not displayed and the value of OK is set to false.

Multiple choice filters and descriptions of the file types can be specified if <file description> follows this format:

"<file description 1>|<*.ext1>|<file description 2>|<*.ext2> ..."

The format must be followed exactly or the description will be ignored. Quotes must surround the entire file description string. There should be no spaces either side if the vertical bar separators.

[VDS6] If a Save dialog is opened, and the user types a filename without an extension, an extension matching the <*.ext> in the selected filter will be appended to the filename that is returned by the function.

OK:

True if dialog was closed with the OK button, otherwise false.

 

Example:

 

%F = @filedlg(*.txt)

%F = @filedlg("Text file (*.txt)|*.txt|Document file (*.doc)|*.doc",Open file)

 

See also:

 


@DIRDLG