The following code example demonstrate the use of main_menu::create_standard_items factory.
- Windows
-
- macOS
-
- Gnome
-
#include <xtd/xtd>
namespace examples {
class form1 :
public form {
public:
form1() {
text("Main menu create standard items example");
menu(main_menu::create_standard_items([&](
object& sender,
const event_args& e) {
list_box1.items().push_back(ustring::format("{} clicked", as<menu_item&>(sender).text()));
list_box1.selected_index(list_box1.items().size() - 1);
if (as<menu_item&>(sender).text() == system_texts::exit()) application::exit();
}));
list_box1.parent(*this);
list_box1.dock(dock_style::fill);
}
private:
};
}
int main() {
application::enable_menu_images();
application::run(examples::form1());
}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17