#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);
      list_box1.dock(dock_style::fill);
    }
    
  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();
    }
    
    main_menu main_menu1 = main_menu::create_standard_items({*
this, &form1::on_menu_click});
 
    
  };
}
 
auto main() -> int {
  application::run(main_menu_create_standard_items_example::form1 {});
}
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:41
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10