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
application_context.cpp

The following code example demonstrate the use of xtd::forms::application and xtd::forms::application_context classes.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace xtd::forms;
int main() {
form form1;
form1.click += [&] {
context.main_form(form1);
};
form1.text("Form 1 (Click the client area to set form as the main form)");
form1.show();
form form2;
form2.click += [&] {
context.main_form(form2);
};
form2.text("Form 2 (Click the client area to set form as the main form)");
form2.show();
form form3;
form3.click += [&] {
context.main_form(form3);
};
form3.text("Form 3 (Click the client area to set form as the main form)");
form3.show();
// if no client area form clicked, the application will not exit when you close the forms.
application::run(context);
}
Specifies the contextual information about an application thread.
Definition application_context.h:26
const form & main_form() const
Gets the form to use as context.
Definition application_context.h:44
virtual const xtd::ustring & text() const
Gets the text associated with this control.
Definition control.h:650
virtual void show()
Displays the control to the user.
Definition control.h:989
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:40
event< control, event_handler > click
Occurs when the control is clicked.
Definition control.h:1065
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13