xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
folder_browser_dialog.cpp

The following code example demonstrate the use of folder_browser_dialog dialog.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace std;
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Folder browser dialog example");
controls().push_back(button1);
button1.location({10, 10});
button1.text("Folder...");
button1.click += [&] {
dialog.selected_path(selected_path);
if (dialog.show_sheet_dialog(*this) == forms::dialog_result::ok) {
selected_path = dialog.selected_path();
label1.text(ustring::format("Path = {}", selected_path));
}
};
label1.parent(*this);
label1.text("Path = ");
label1.auto_size(true);
label1.location({10, 40});
}
private:
button button1;
label label1;
ustring selected_path;
};
int main() {
application::run(form1());
}
Represents a Windows button control.
Definition button.h:54
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs a common dialog box with the specified owner.
Definition common_dialog.h:91
Prompts the user to select a folder. This class cannot be inherited.
Definition folder_browser_dialog.h:22
const xtd::ustring & selected_path() const
Gets the path selected by the user.
Definition folder_browser_dialog.h:71
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:40
Represents a standard Windows label.
Definition label.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
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