Vcl.Dialogs.PromptForFileName

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function PromptForFileName(var AFileName: string; const AFilter: string = ''; const ADefaultExt: string = ''; const ATitle: string = ''; const AInitialDir: string = ''; SaveDialog: Boolean = False): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall PromptForFileName(System::UnicodeString &AFileName, const System::UnicodeString AFilter = System::UnicodeString(), const System::UnicodeString ADefaultExt = System::UnicodeString(), const System::UnicodeString ATitle = System::UnicodeString(), const System::UnicodeString AInitialDir = System::UnicodeString(), bool SaveDialog = false);

Properties

Type Visibility Source Unit Parent
function public
Vcl.Dialogs.pas
Vcl.Dialogs.hpp
Vcl.Dialogs Vcl.Dialogs

Description

Displays an open or save dialog, where the user can specify a file name.

Call PromptForFileName to display an open or save dialog.

AFilename is the name of the file. The value supplied by the caller is used to initialize the file name in the dialog. On exit, AFileName contains the name specified in the dialog.

AFilter determines the file masks (filters) available in the dialog. If AFilter is set to an empty string, the dialog uses the string 'All files (*.*)', which causes the dialog to display all files in the current directory. For information on filter strings, see Filter.

ADefaultExt specifies a file extension that is appended automatically to the specified file name, unless the selected file name already includes a registered extension. If the user specifies a file name with an extension that is unregistered, ADefaultExt is appended to the unregistered extension.

ATitle specifies the title for the dialog. If ATitle is set to an empty string, the dialog uses 'Open' or 'Save As', depending on the value of the SaveDialog parameter.

AInitialDir specifies the directory displayed in the dialog when it opens. If AInitialDir is an empty string, or if the specified directory does not exist, the initial directory is the current working directory.

SaveDialog specifies whether the file selection should be a Save As dialog (true) or an Open dialog (false).

Options specifies file dialog options.

PromptForFileName returns true if the user selected a file name, false if the user exited by clicking the cancel button.

See Also