xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
save_file_dialog.cpp

The following code example demonstrate the use of save_file_dialog dialog.

Windows
save_file_dialog_w.png

save_file_dialog_wd.png
macOS
save_file_dialog_m.png

save_file_dialog_md.png
Gnome
save_file_dialog_g.png

save_file_dialog_gd.png
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Save file dialog example");
controls().push_back(button1);
button1.location({10, 10});
button1.text("Save...");
button1.click += [&] {
dialog.file_name("MyFile.txt");
dialog.filter("Text Files (*.txt)|*.txt;*.md|All Files (*.*)|*.*");
if (dialog.show_sheet_dialog(*this) == dialog_result::ok)
label1.text(ustring::format("File = {0}", dialog.file_name()));
};
label1.parent(*this);
label1.text("File = ");
label1.auto_size(true);
label1.location({10, 40});
}
private:
label label1;
};
int main() {
application::run(form1());
}