Method XbpFileDialog():saveAs() Foundation

Activates the file dialog for saving a file.

Syntax
:saveAs( [<cDefaultFile>], ;
         [<lFileList>], ;
         [<lCenter>] ) --> cFileName | NIL
Parameters
<cDefaultFile>
An optional character string can be specified for the <cDefaultFile> parameter. If a string is specified and contains a valid path, the respective folder is set as the initial directory displayed by the file dialog. If it contains a file name (either with or without path information), it is displayed in the entry field "File name:" of the file dialog and denotes the default file name for saving the file.
On some Windows platforms, the default folder displayed in the dialog is determined by the operating system.
Windows 2000, XP and 2003 Server systems - If no path is specified in <cDefaultFile> and the application has opened a file dialog in the past, the path most recently is used as the initial directory of the dialog. Path info is stored by the operating system only for a certain time period. Once the time period has elapsed, or if no file dialog has been opened by the application, the current directory is used if the directory contains files of the required type. Otherwise, the "Personal Files" folder is used.
Windows 98, ME systems - If no path is specified in <cDefaultFile>, the current directory is used as the initial directory if the directory contains files of the required type. Otherwise, the "Personal Files" folder is used.
All other Windows platforms - If no path is specified in <cDefaultFile>, the current directory is used as the initial directory displayed by the dialog.
<lFileList>
The optional <lFileList> parameter determines whether the list of file names in the file dialog is enabled. The default value is .T. (true) and the user can select a file name from the file name list (an existing file can be selected). If .F. (false) is specified for <lFileList>, a file name must be entered in the "File name:" entry field of the dialog. Selecting a file name from the list of existing files is not possible when this parameter is .F. (false).
<lCenter>
The optional parameter <lCenter> determines whether the file dialog is centered in the parent window. This parameter must be a logical value and its effect is identical to the :center instance variable. If <lCenter> is specified, the :center instance variable is ignored.

Beginning with Windows Vista, the operating system uses a classic/compatible window style for dialogs which are customized in any way. For this reason, passing .T. in <lCenter> or setting :center to .T. is discouraged on Windows Vista and newer operating systems.

Return

When the file dialog is closed using the "OK" pushbutton, this method returns the entire file name as a character string including the drive and directory. If the dialog is not closed using the "OK" pushbutton, the return value is NIL.

Description

The :saveAs() method displays and activates the file dialog. The user can specify a file in any directory on any drive using the file dialog. The user makes a selection by pressing the "OK" pushbutton. This also closes the dialog and this method returns the selected file name including its drive and directory. The dialog can also be closed using the "Cancel" pushbutton or the dialog's window menu. In either of these cases, no file has been selected and this method returns NIL.

The file dialog is generally activated using :saveAs() when a user needs to save a file (or save it under a different name). When opening a file, the file dialog is generally activated using the :open() method.

On Windows platforms, the file list is not disabled if parameter <lFileList> is .F. (false). Furthermore, a file name that denotes an existing file is not rejected. Instead, the user is prompted whether the file should be overwritten and the name of the file is returned if the user acknowledges.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.