-
Notifications
You must be signed in to change notification settings - Fork 61
How to create application and run the message loop ?
| xtd | News | Gallery | Examples | Downloads | Documentation | Wiki | Support | Sources | Project | Gammasoft |
The application is a static class. The "application" is created when one of the run member methods is called, and destroyed when the method is exited.
The message loop is started too when one of the run member methods is called, and stopped when the method is exited.
To exit the message loop, you must either call the application's exit or exit_thread method, or close the main form.
Call the run method without argument.
#include <xtd/forms/application>
using namespace xtd::forms;
auto main()->int {
application::run();
}
Create a form, show it and call the run method without argument.
#include <xtd/forms/application>
using namespace xtd::forms;
auto main()->int {
auto form1 = form {};
form1.text("My first application");
form1.show();
application::run();
}
Simply create a form and pass it as a parameter to the run method.
#include <xtd/forms/application>
using namespace xtd::forms;
auto main()->int {
auto form1 = form {};
form1.text("My first application");
application::run(form1);
}
Create a form and an application_context. Use the application_context as parameter of the application run method.
The application_context is used to modify the main form at any time. In fact, the main_form property is used to modify the main form or simply not to designate one.
#include <xtd/forms/application>
using namespace xtd::forms;
auto main()->int {
auto form1 = form {};
form1.text("My first application");
auto context = application_context {form1};
application::run(context);
}
© 2025 Gammasoft.