-
Notifications
You must be signed in to change notification settings - Fork 61
What is the difference between dialog and box ?
Gammasoft edited this page Nov 12, 2023
·
8 revisions
| xtd | News | Gallery | Examples | Downloads | Documentation | Wiki | Support | Sources | Project | Gammasoft |
All standard dialogs are defined with two classes: dialog and box.
For example, for the message dialog we have: message_dialog and message_box. And for about dialog we have: about_dialog and about_box. And so on.
Dialog classes contain properties and methods. You must instantiate it, define its properties, then display it and retrieve the result if necessary.
Box classes are static classes that only contain an overload of the show method with different parameters.
Use the version you prefer. The result will be the same.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/message_dialog>
using namespace xtd::forms;
auto main()->int {
auto message = message_dialog {};
message.buttons(xtd::forms::message_dialog_buttons::ok_cancel);
message.icon(xtd::forms::message_dialog_icon::question);
message.message("What do you thing about message dialog ?");
message.text("Message");
auto form1 = form::create("How to use the message dialog");
auto button1 = button::create(form1, "Click me", {10, 10});
button1.click += [&] {
message.show_sheet_dialog(form1);
};
application::run(form1);
}
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/message_box>
using namespace xtd::forms;
auto main()->int {
auto form1 = form::create("How to use the message dialog");
auto button1 = button::create(form1, "Click me", {10, 10});
button1.click += [&] {
message_box::show(form1, "What do you thing about message dialog ?", "Message", xtd::forms::message_box_buttons::ok_cancel, xtd::forms::message_box_icon::question);
};
application::run(form1);
}
© 2024 Gammasoft.