xtd - Reference Guide  0.1.1
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

macOS

Gnome

#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 += [&] {
save_file_dialog dialog;
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());
}
static xtd::ustring get_folder_path(environment::special_folder folder)
Gets the path to the system special folder that is identified by the specified enumeration.
Definition: environment.h:301
@ desktop
The logical Desktop rather than the physical file system location.
static void run()
Begins running a standard application message loop on the current thread, without a form.
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: ustring.h:689
@ ok
The dialog box return value is OK (usually sent from a button labeled OK).
@ button1
The first button on the message box is the default button.
@ button
The appearance of a button.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17