FileSaveAsDlg() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Displays a Save As dialog box, and returns the name of the file the user entered. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

FileSaveAsDlg( path, filename, filetype, prompt )

path is a string value, indicating the default destination directory.

filename is a string value, indicating the default file name.

filetype is a string value, indicating the type of file that the dialog box lets the user choose.

prompt is a string title that appears at the top of the dialog box.

Return Value

String value, representing the name of the file the user entered (or an empty string if the user cancelled).

Description

The FileSaveAsDlg() function displays a Save As dialog box, similar to the dialog box that displays when the user chooses Save Copy As command.

The user can type in the name of the file they want to save. Alternately, the user can double-click from the list of grayed-out filenames that appears in the dialog box. Since each file name in the list represents an existing file, MapBasic asks the user to verify that they want to overwrite the existing file.

If the user specifies a filename and clicks OK, the FileSaveAsDlg() function returns a character string representing the full path and name of the file the user chose. If the user clicks the Cancel button instead of picking a file, the function returns a null string ("").

The path parameter specifies the initial directory path. The user can change directories once the dialog box appears. If the path parameter is blank (a null string), the dialog box presents a list of files in the current directory.

The filename parameter specifies the default file name for the user to choose.

The filetype parameter is a three-character (or shorter) string which identifies the type of files that should appear in the dialog box. To display a dialog box that lists workspaces, specify the string "WOR" as the filetype parameter; to display a dialog box that lists table names, specify the string "TAB." See FileOpenDlg() function for more information about three-character filetype codes.

The FileSaveAsDlg() function does not actually save any files; it merely presents the user with a dialog box, and lets the user choose a file name to save. To save data under the file name chosen by the user, issue a statement such as the Commit Table statement.

See Also:

Commit Table statement, FileOpenDlg() function