RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Dialogs.PromptForFileName Function

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

Pascal
function PromptForFileName(var AFileName: string; const AFilter: string = ''; const ADefaultExt: string = ''; const ATitle: string = ''; const AInitialDir: string = ''; SaveDialog: Boolean = False): Boolean;
C++
Boolean PromptForFileName(AnsiString AFileName, const AnsiString AFilter = '', const AnsiString ADefaultExt = '', const AnsiString ATitle = '', const AnsiString AInitialDir = '', Boolean SaveDialog = False);

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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!