Command Reference : Programming Language Reference
Syntax: @uifiledlg(IO_Filespec, filter, type)
Argument 1: string, IO_Filespec
Argument 2: string, filter
Argument 3: string, type
Return: integer
Displays a standard Windows file open or save dialog. The initial location and possibly the name of the file is given by the string IO_Filespec, which will also contain the selected file on return. You will specify the types of files to show in the dialog using the filter argument, with, for example, “” used to denote all files, and “prg” used to limit the display to files ending in “.prg”. The type argument is used to determine whether the shown dialog has an “open” or a “save” title.
(Note that the clicking OK on the dialog does not actually open or save the selected file, it merely returns the name of the selected file. Thus, specifying the type argument is simply cosmetic.)
Both filter and style may be specified using in-line text, but IO_Filespec must be either a program variable or an object in your workfile as it is used to return results.
The displayed dialog will display both an OK and a Cancel button, and will return an integer representing the button clicked: Cancel (-1), OK (0).
string myfile = "c:\temp\"
@uifiledlg(myfile, "prg", "open")
These commands display a file open dialog style containing a list of all files with a “.prg” extension in the folder “c:\temp\”. The user can navigate through the file system and select another file, whose path and name will be returned in the string MYFILE.
Note that both the filter and style arguments are specified using in-line strings, but that the filespec is passed in using a string object.
Note that the slightly different set of commands
string myfile = "c:\temp"
@uifiledlg(myfile, "prg", "save")
will instead display a save dialog that opens in the “c:\” folder with the filename initialized to “temp.prg” (MYFILE does not have the trailing “\”).
Leaving the filename argument blank on input will open the dialog in the default EViews directory:
string myfile = ""
@uifiledlg(myfile, "", "save")
opens a save dialog in the default EViews directory with no filtering and no default file.
See “User-Defined Dialogs” for discussion.
See also @uidialog, @uiedit, @uilist, @uiprompt, @uiradio.