This example demonstrates how to launch form as normal window , model-less window and modal window.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/vertical_layout_panel>
#include <xtd/startup>
namespace example {
class form1 :
public form {
public:
form1() {
client_size({320, 610});
controls().push_back(layout_panel);
text(
"Form show example");
layout_panel.controls().push_back_range({button_normal, button_modeless, button_top_most, button_modal, button_sheet, button_sheet_modal});
button_normal.text("Show normal");
button_normal.click += [&] {
dialog->text("dialog show normal");
dialog->size({250, 100});
dialog->show();
dialogs.push_back(dialog);
};
button_modeless.text("Show modeless");
button_modeless.click += [&] {
dialog->text("dialog show modeless");
dialog->size({250, 100});
dialog->owner(*this).show();
dialogs.push_back(dialog);
};
button_top_most.text("Show top most");
button_top_most.click += [&] {
dialog->text("dialog top most");
dialog->size({250, 100});
dialog->top_most(true).show();
dialogs.push_back(dialog);
};
button_modal.text("Show modal");
button_modal.click += [&] {
dialog.show_dialog(*this);
};
button_sheet.text("Show sheet");
button_sheet.click += [&] {
dialog->text("dialog show sheet").size({250, 100});
};
dialog->show_sheet(*this);
dialogs.push_back(dialog);
};
button_sheet_modal.text("Show sheet modal");
button_sheet_modal.click += [&] {
};
dialog.show_sheet_dialog(*this);
};
}
static auto main() {
}
private:
};
}
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:167
ptr< type_t > new_ptr(args_t &&... args)
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ control
The left or right CTRL modifier key.
Definition console_modifiers.hpp:28
@ e
The E key.
Definition console_key.hpp:96
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31