#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/list_box>
#include <xtd/forms/main_menu>
namespace main_menu_create_standard_items_example {
class form1 :
public form {
public:
form1() {
text(
"Main menu create standard items example");
list_box1.parent(*this);
}
private:
void on_menu_click(
object& sender,
const event_args&
e) {
list_box1.items().push_back(string::format(
"{} clicked",
as<menu_item>(sender).
text()));
list_box1.selected_index(list_box1.items().size() - 1);
if (main_menu1.menu_items()[0].get().menu_items()[9].get() == sender)
application::exit();
}
list_box list_box1;
};
}
auto main() -> int {
}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents the menu structure of a form.
Definition main_menu.hpp:42
static xtd::forms::main_menu create_standard_items(const xtd::event_handler &on_click)
A factory to create a main menu with specified on click event handler.
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ e
The E key.
Definition console_key.hpp:96
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8