xtd 0.2.0
exception_dialog.cpp

demonstrates the use of xtd::forms::exception_dialog dialog.

Windows
exception_dialog_w.png

exception_dialog_wd.png
macOS
exception_dialog_m.png

exception_dialog_md.png
Gnome
exception_dialog_g.png

exception_dialog_gd.png
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/exception_dialog>
#include <xtd/forms/form>
#include <xtd/invalid_operation_exception>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Exception dialog example");
controls().push_back(button1);
button1.location({10, 10});
button1.auto_size(true);
button1.text("Exception...");
button1.click += [&] {
try {
throw invalid_operation_exception("Throws an invalid operation exception to show an exception dialog.", current_stack_frame_);
} catch (const xtd::system_exception& e) {
auto dialog = exception_dialog {};
dialog.exception(e);
if (dialog.show_sheet_dialog(*this) == dialog_result::cancel)
}
};
}
private:
};
auto main()->int {
application::run(form1 {});
}