xtd 0.2.0
xtd::forms::save_file_box Class Referencefinal
Inheritance diagram for xtd::forms::save_file_box:
xtd::static_object

Definition

Represents a common dialog box that displays a file save dialog to the user to select a location for saving a file.

Header
#include <xtd/forms/save_file_box>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light
Dark
Examples
The following code example demonstrates the use of xtd::forms::save_file_box dialog.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/message_box>
#include <xtd/forms/save_file_box>
#include <xtd/environment>
#include <xtd/literals>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Save file box example");
client_size({400, 200});
controls().push_back(button_save_file);
button_save_file.parent(*this)
.location({10, 10})
.size({150, 35})
.text("Save file")
.click += [this] {
auto file_name = "MyFile.txt"_s;
auto res = save_file_box::show(file_name, *this, "Save file as...", environment::get_folder_path(environment::special_folder::my_documents), "*.txt");
if (res == dialog_result::ok)
message_box::show(string::format("File will be saved as:\n{}", file_name));
};
}
private:
button button_save_file;
};
auto main() -> int {
application::run(form1 {});
}
@ my_documents
The My Documents folder. This member is equivalent to Personal.
Definition environment.hpp:153
static xtd::string get_folder_path(environment::special_folder folder)
Gets the path to the system special folder that is identified by the specified enumeration.
Definition environment.hpp:613
static void run()
Begins running a standard application message loop on the current thread, without a form.
void push_back(const value_type &value) override
Adds an element to the end.
virtual const drawing::size & client_size() const noexcept
Gets the height and width of the client area of the control.
virtual control_collection & controls() noexcept
Gets the collection of controls contained within the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
static dialog_result show()
Displays a message box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner)
Displays a save file dialog box in front of a specified window.
xtd::forms::style_sheets::control button
The buttton data allows you to specify the box of a button control.
Definition button.hpp:25
@ size
Specifies that both the width and height property values of the control are defined.
Definition bounds_specified.hpp:36
@ ok
The dialog box return value is OK (usually sent from a button labeled OK).
Definition dialog_result.hpp:47
@ text
The xtd::forms::status_bar_panel displays text in the standard font.
Definition status_bar_panel_style.hpp:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8

Public Static Methods

static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const save_file_box_options options)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const save_file_box_options options)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const save_file_box_options options)
 Displays a save file dialog box in front of a specified window.
 
static xtd::forms::dialog_result show (xtd::string &file_name)
 Displays a save file dialog box.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::string &title)
 Displays a save file dialog box.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::string &title, const save_file_box_options options)
 Displays a select file dialog box.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory)
 Displays a save file dialog box.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const save_file_box_options options)
 Displays a save file dialog box.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter)
 Displays a save file dialog box.
 
static xtd::forms::dialog_result show (xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const save_file_box_options options)
 Displays a save file dialog box.
 

Member Function Documentation

◆ show() [1/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [2/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner,
const xtd::string & title )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
titleAn xtd::string that specifies the caption title of the file dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [3/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner,
const xtd::string & title,
const save_file_box_options options )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
titleAn xtd::string that specifies the caption title of the file dialog box.
optionsA bitwise combination of enum xtd::forms::save_file_box_options to specify additional options to the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [4/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner,
const xtd::string & title,
const xtd::string & initial_directory )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [5/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner,
const xtd::string & title,
const xtd::string & initial_directory,
const save_file_box_options options )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
optionsA bitwise combination of enum xtd::forms::save_file_box_options to specify additional options to the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [6/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner,
const xtd::string & title,
const xtd::string & initial_directory,
const xtd::string & filter )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
filterAn xtd::string that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example:
(*.txt)|*.txt|All files (*.*)|*.* 
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [7/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::forms::iwin32_window & owner,
const xtd::string & title,
const xtd::string & initial_directory,
const xtd::string & filter,
const save_file_box_options options )
static

Displays a save file dialog box in front of a specified window.

Parameters
file_nameAn output xtd::string that will store the selected file name.
ownerAn If xtd::forms::iwin32_window that represents the owner window of the file dialog box.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
filterAn xtd::string that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example:
(*.txt)|*.txt|All files (*.*)|*.* 
optionsA bitwise combination of enum xtd::forms::save_file_box_options to specify additional options to the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [8/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name)
static

Displays a save file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [9/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::string & title )
static

Displays a save file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
titleAn xtd::string that specifies the caption title of the file dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [10/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::string & title,
const save_file_box_options options )
static

Displays a select file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
titleAn xtd::string that specifies the caption title of the file dialog box.
optionsA bitwise combination of enum xtd::forms::save_file_box_options to specify additional options to the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [11/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::string & title,
const xtd::string & initial_directory )
static

Displays a save file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [12/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::string & title,
const xtd::string & initial_directory,
const save_file_box_options options )
static

Displays a save file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
optionsA bitwise combination of enum xtd::forms::save_file_box_options to specify additional options to the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [13/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::string & title,
const xtd::string & initial_directory,
const xtd::string & filter )
static

Displays a save file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
filterAn xtd::string that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example:
(*.txt)|*.txt|All files (*.*)|*.* 
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

◆ show() [14/14]

static xtd::forms::dialog_result xtd::forms::save_file_box::show ( xtd::string & file_name,
const xtd::string & title,
const xtd::string & initial_directory,
const xtd::string & filter,
const save_file_box_options options )
static

Displays a save file dialog box.

Parameters
file_nameAn output xtd::string that will store the selected file name.
titleAn xtd::string that specifies the caption title of the file dialog box.
initial_directoryAn xtd::string that specifies the initial directory displayed by the file dialog box
filterAn xtd::string that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example:
(*.txt)|*.txt|All files (*.*)|*.* 
optionsA bitwise combination of enum xtd::forms::save_file_box_options to specify additional options to the file dialog box
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.

The documentation for this class was generated from the following file: