SaveFileDialog

Pops up a dialog box for the user to save a file.

Constructors

this
this(Window parent, string title)

Construct the dialog.

this
this(string title)

Construct the dialog.

Members

Functions

setConfirmOverwrite
auto setConfirmOverwrite(bool confirm)

Configures how the Save dialog reacts when the selected file already exists, and saving would overwrite it. A true value requests a confirmation dialog be presented to the user. A false value requests that the overwrite take place without confirmation. Default value is true.

show
auto show()

Show the dialog.

Inherited Members

From FileDialog

_defaultExtension
string _defaultExtension;
Undocumented in source.
_fileTypes
string[] _fileTypes;
Undocumented in source.
_initialDirectory
string _initialDirectory;
Undocumented in source.
_initialFile
string _initialFile;
Undocumented in source.
_typeVariable
string _typeVariable;
Undocumented in source.
setDefaultExtension
auto setDefaultExtension(string extension)

Set the default extension.

addFileType
auto addFileType(string fileType)

Add an allowed file type. If a filetype combobox exists in the file dialog on the particular platform, this adds entries to it. When the user choose a filetype in the combobox, only the files of that type are listed. If no types are added or if the filetypes combobox is not supported by the particular platform then all files are listed regardless of their types.

setInitialDirectory
auto setInitialDirectory(string directory)

Set the initial directory in the dialog.

setInitialFile
auto setInitialFile(string file)

Set the initial file in the dialog.

Examples

auto dialog = new SaveFileDialog("Save a file")
	.setConfirmOverwrite(true)
	.setDefaultExtension(".txt")
	.addFileType("{{All files} {*}}")
	.addFileType("{{Text files} {.txt}}")
	.setInitialDirectory("~")
	.setInitialFile("file.txt")
	.show();

string fileToWrite = dialog.getResult();

Result: The full path of the file selected.

See Also

Meta