xtd 1.0.0
Loading...
Searching...
No Matches
form2.cpp

represents a window or dialog box that makes up an application's user interface.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/message_box>
auto main() -> int {
auto form = xtd::forms::form::create("form1");
form.form_closing += delegate_(auto & sender, auto & event) {event.cancel(xtd::forms::message_box::show("Are you sure you want exit?", "Close Form", xtd::forms::message_box_buttons::yes_no, xtd::forms::message_box_icon::question) == xtd::forms::dialog_result::no);};
auto button_close = xtd::forms::button::create(form, "Close", {10, 10});
button_close.click += {form, &xtd::forms::form::close};
}
static auto run() -> void
Begins running a standard application message loop on the current thread, without a form.
static auto create() -> button
A factory to create an xtd::forms::button.
static auto create() -> form
A factory to create an xtd::forms::form.
auto close() -> void
Closes the form.
static auto show(const xtd::forms::iwin32_window &owner) -> xtd::forms::dialog_result
Displays a message box in front of the specified window.
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:1018
@ no
The dialog box return value is No (usually sent from a button labeled No).
Definition dialog_result.hpp:59