xtd 0.2.0
save_file_box.cpp

demonstrates the use of xtd::forms::save_file_box file dialog.

Windows
save_file_box_w.png

save_file_box_wd.png
macOS
save_file_box_m.png

save_file_box_md.png
Gnome
save_file_box_g.png

save_file_box_gd.png
#include <xtd/xtd>
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] {
ustring file_name = "MyFile.txt";
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(ustring::format("File will be saved as:\n{}", file_name));
};
}
private:
button button_save_file;
};
auto main()->int {
application::run(form1 {});
}