xtd 0.2.0
application_events.cpp

demonstrates the use of application events.

Windows

macOS

Gnome

#define TRACE
#include <xtd/diagnostics/trace>
#include <xtd/forms/application>
#include <xtd/forms/debug_form>
#include <xtd/forms/form>
using namespace xtd;
using namespace xtd::diagnostics;
using namespace xtd::forms;
auto main() -> int {
auto df = debug_form {};
form form1;
button1.auto_size(true);
button1.location({10, 10});
button1.text("show dialog");
button1.parent(form1);
button1.click += [] {
form dialog;
dialog.text("dialog");
dialog.client_size({200, 100});
dialog.show_dialog();
};
trace::write_line("Application exit");
};
trace::write_line("Enter thread modal");
};
static auto cpt = 0;
trace::write_line(string::format("Idle [{}]...", ++cpt));
};
trace::write_line("Leave thread modal");
};
trace::write_line("Thread exit");
};
}
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition trace.hpp:343
static event< application, delegate< void(const event_args &)> > enter_thread_modal
Occurs when the application is about to enter a modal state.
Definition application.hpp:322
static void run()
Begins running a standard application message loop on the current thread, without a form.
static event< application, delegate< void(const event_args &)> > thread_exit
Occurs when a thread is about to shut down. When the main thread for an application is about to be sh...
Definition application.hpp:348
static event< application, delegate< void(const event_args &)> > leave_thread_modal
Occurs when the application is about to leave a modal state.
Definition application.hpp:334
static event< application, delegate< void(const event_args &)> > idle
Occurs when the application finishes processing and is about to enter the idle state.
Definition application.hpp:330
static event< application, delegate< void(const event_args &)> > application_exit
Occurs when the application is about to shut down.
Definition application.hpp:318
Represents a Windows button control.
Definition button.hpp:49
virtual const drawing::size & client_size() const noexcept
Gets the height and width of the client area of the control.
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
Represents a form that displays debug form. This class cannot be inherited.
Definition debug_form.hpp:36
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
virtual forms::dialog_result show_dialog()
Shows the form as a modal dialog box.
@ button1
The first button on the message box is the default button.
Definition message_dialog_default_button.hpp:24
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8