xtd - Reference Guide  0.2.0 Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.

#include <menu_item.h>

## Definition

Represents an individual item that is displayed within a main_menu or context_menu.

Namespace
xtd::forms
Library
xtd.forms
Examples:

## Constructors

Initializes a menu_item with a blank caption. More...

Initializes a new instance of the menu_item class with a specified caption for the menu item. More...

menu_item (const xtd::ustring &text, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, and associated shortcut key for the menu item. More...

menu_item (const xtd::ustring &text, const xtd::drawing::image &image)
Initializes a new instance of the class with a specified caption, and image menu item. More...

menu_item (const xtd::ustring &text, const xtd::drawing::image &image, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, and image menu item, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption, and kind the menu item. More...

Initializes a new instance of the class with a specified caption, kind the menu item, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption, image menu item, and kind the menu item. More...

Initializes a new instance of the class with a specified caption, image menu item, kind the menu item, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption, kind the menu item and checked. More...

Initializes a new instance of the class with a specified caption, kind the menu item, checked, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption, image menu item, kind the menu item, and checked. More...

menu_item (const xtd::ustring &text, const xtd::drawing::image &image, xtd::forms::menu_item_kind kind, bool checked, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, image menu item, kind the menu item, checked, and associated shortcut key for the menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click)
Initializes a new instance of the class with a specified caption and event handler for the Click event of the menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, event handler, and associated shortcut key for the menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, const xtd::drawing::image &image)
Initializes a new instance of the class with a specified caption, event handler, and image menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, const xtd::drawing::image &image, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, event handler, and image menu item, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption, event handler, and kind the menu item. More...

Initializes a new instance of the class with a specified caption, event handler, kind the menu item, and associated shortcut key for the menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, const xtd::drawing::image &image, xtd::forms::menu_item_kind kind)
Initializes a new instance of the class with a specified caption, event handler, image menu item, and kind the menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, const xtd::drawing::image &image, xtd::forms::menu_item_kind kind, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, event handler, image menu item, kind the menu item, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption, event handler, kind the menu item and checked. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, xtd::forms::menu_item_kind kind, bool checked, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, event handler, kind the menu item, checked, and associated shortcut key for the menu item. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, const xtd::drawing::image &image, xtd::forms::menu_item_kind kind, bool checked)
Initializes a new instance of the class with a specified caption, event handler, image menu item, kind the menu item, and checked. More...

menu_item (const xtd::ustring &text, const xtd::event_handler &on_click, const xtd::drawing::image &image, xtd::forms::menu_item_kind kind, bool checked, xtd::forms::shortcut shortcut)
Initializes a new instance of the class with a specified caption, event handler, image menu item, kind the menu item, checked, and associated shortcut key for the menu item. More...

Initializes a new instance of the class with a specified caption and an array of submenu items defined for the menu item. More...

## Properties

Gets a value indicating the Windows identifier for this menu item. More...

bool checked () const
Gets a value indicating whether a check mark appears next to the text of the menu item. More...

Sets a value indicating whether a check mark appears next to the text of the menu item. More...

bool enabled () const
Gets a value indicating whether the menu item is enabled. More...

Gets a value indicating whether the menu item is enabled. More...

bool is_parent () const override
Gets a value indicating whether this menu contains any menu items. More...

Gets a value that represents the kind of menu item. More...

Sets a value that represents the kind of menu item. More...

xtd::forms::shortcut shortcut () const
Gets a value indicating the shortcut key associated with the menu item. More...

Sets a value indicating the shortcut key associated with the menu item. More...

const xtd::ustringtext () const
Gets a value indicating the caption of the menu item. More...

Sets a value indicating the caption of the menu item. More...

## Methods

void perform_click ()
Generates a xtd::forms::menu_item::click event for the xtd::forms::menu_item, simulating a click by a user. More...

xtd::ustring to_string () const noexcept override
Returns a string that represents the menu control. More...

## Events

Occurs when the menu item is clicked or selected using a shortcut key or access key defined for the menu item. More...

## Protected methods

Creates a new handle to the Menu. More...

Destroy the handle to the Menu. More...

virtual void on_click (const event_args &e)
Raises the Click event. More...

void on_item_removed (size_t pos, menu_item_ref item) override

Represents a collection of menu_item objects. More...

Static Public Attributes inherited from xtd::forms::menu
static constexpr const int find_handle = 0
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a handle. More...

static constexpr const int find_shortcut = 1
Specifies that the find_menu_item(int32_t, intptr_t) method should search for a shortcut. More...

Public Member Functions inherited from xtd::forms::menu
intptr_t handle () const
Gets a value representing the window handle for the menu. More...

Gets a value indicating the menu_item that is used to display a list of multiple document interface (MDI) child forms. More...

Gets a value indicating the collection of menu_item objects associated with the menu. More...

Gets a value indicating the collection of menu_item objects associated with the menu. More...

Sets a value indicating the collection of menu_item objects associated with the menu. More...

const xtd::ustringname () const
Gets the name of the menu. More...

Sets the name of the menu. More...

std::any tag () const
Gets user-defined data associated with the control. More...

Sets user-defined data associated with the control. More...

bool equals (const menu &) const noexcept override

bool equals (const object &) const noexcept override
Indicates whether the current object is equal to another object of the same type. More...

Public Member Functions inherited from xtd::object
object ()=default
Create a new instance of the ultimate base class object. More...

virtual size_t get_hash_code () const noexcept
Serves as a hash function for a particular type. More...

template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
Gets the type of the current instance. More...

Public Member Functions inherited from xtd::iequatable< menu >
virtual bool equals (const menu &) const noexcept=0
Indicates whether the current object is equal to another object of the same type. More...

Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
Determines whether the specified object instances are considered equal. More...

static bool reference_equals (const object &object_a, const object &object_b) noexcept
Determines whether the specified object instances are the same instance. More...

Protected Member Functions inherited from xtd::forms::menu
Initializes a new instance of the Menu class. More...

Initializes a new instance of the Menu class. More...

Copies the menu that is passed as a parameter to the current menu. More...

Protected Member Functions inherited from xtd::forms::component
component ()=default
Initialises a new instance of the component class. More...

virtual bool can_raise_events () const
Gets a value indicating whether the component can raise an event. More...

bool design_mode () const
Gets a value that indicates whether the component is currently in design mode. More...

## Constructor & Destructor Documentation

Initializes a menu_item with a blank caption.

Remarks
Once you have created a blank menu_item using this constructor, you can use the properties and methods of the menu_item class to specify the appearance and behavior of your menu_item.

explicit

Initializes a new instance of the menu_item class with a specified caption for the menu item.

Parameters
 text The caption for the menu item.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, and image menu item.

Parameters
 text The caption for the menu item. image A xtd::drawing::image menu item.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::drawing::image & image, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, and image menu item, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. image A xtd::drawing::image menu item. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, and kind the menu item.

Parameters
 text The caption for the menu item. kind One of the xtd::forms::menu_item_kind value.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, kind the menu item, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. kind One of the xtd::forms::menu_item_kind value. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, image menu item, and kind the menu item.

Parameters
 text The caption for the menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, image menu item, kind the menu item, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, kind the menu item and checked.

Parameters
 text The caption for the menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, kind the menu item, checked, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, image menu item, kind the menu item, and checked.

Parameters
 text The caption for the menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::drawing::image & image, xtd::forms::menu_item_kind kind, bool checked, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, image menu item, kind the menu item, checked, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption and event handler for the Click event of the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, event handler, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, const xtd::drawing::image & image )

Initializes a new instance of the class with a specified caption, event handler, and image menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. image A xtd::drawing::image menu item.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, const xtd::drawing::image & image, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, event handler, and image menu item, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. image A xtd::drawing::image menu item. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, event handler, and kind the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. kind One of the xtd::forms::menu_item_kind value.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, event handler, kind the menu item, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. kind One of the xtd::forms::menu_item_kind value. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, const xtd::drawing::image & image, xtd::forms::menu_item_kind kind )

Initializes a new instance of the class with a specified caption, event handler, image menu item, and kind the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, const xtd::drawing::image & image, xtd::forms::menu_item_kind kind, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, event handler, image menu item, kind the menu item, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption, event handler, kind the menu item and checked.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, xtd::forms::menu_item_kind kind, bool checked, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, event handler, kind the menu item, checked, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, const xtd::drawing::image & image, xtd::forms::menu_item_kind kind, bool checked )

Initializes a new instance of the class with a specified caption, event handler, image menu item, kind the menu item, and checked.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

 xtd::forms::menu_item::menu_item ( const xtd::ustring & text, const xtd::event_handler & on_click, const xtd::drawing::image & image, xtd::forms::menu_item_kind kind, bool checked, xtd::forms::shortcut shortcut )

Initializes a new instance of the class with a specified caption, event handler, image menu item, kind the menu item, checked, and associated shortcut key for the menu item.

Parameters
 text The caption for the menu item. on_click The event_handler that handles the Click event for this menu item. image A xtd::drawing::image menu item. kind One of the xtd::forms::menu_item_kind value. checked true if there is a check mark next to the menu item; otherwise, false. The default is false. shortcut One of the xtd::forms::shortcut values.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

Initializes a new instance of the class with a specified caption and an array of submenu items defined for the menu item.

Parameters
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.
The items parameter enables you to assign an array of menu items to define a submenu of this menu item. Each item in the array can also have an array of menu items assigned to it. This enables you to create complete menu structures and assign them to the constructor for the menu item.

## ◆ checked() [1/2]

inline

Gets a value indicating whether a check mark appears next to the text of the menu item.

Returns
true if there is a check mark next to the menu item; otherwise, false. The default is false.

## ◆ checked() [2/2]

Sets a value indicating whether a check mark appears next to the text of the menu item.

Parameters
 value true if there is a check mark next to the menu item; otherwise, false. The default is false.
Returns

overrideprotectedvirtual

Creates a new handle to the Menu.

Returns
A handle to the menu if the method succeeds; otherwise, 0.

overrideprotectedvirtual

Destroy the handle to the Menu.

Parameters
 handle A handle to the menu.

## ◆ enabled() [1/2]

inline

Gets a value indicating whether the menu item is enabled.

Returns
true if the menu item is enabled; otherwise, false. The default is true.

## ◆ enabled() [2/2]

Gets a value indicating whether the menu item is enabled.

Parameters
 value true if the menu item is enabled; otherwise, false. The default is true.
Returns

## ◆ is_parent()

overridevirtual

Returns
true if this menu contains menu_item objects; otherwise, false. The default is false.

## ◆ kind() [1/2]

inline

Gets a value that represents the kind of menu item.

Returns

## ◆ kind() [2/2]

Sets a value that represents the kind of menu item.

Parameters
 value One of the xtd::forms::menu_item_kind value.
Returns

Gets a value indicating the Windows identifier for this menu item.

Returns
The Windows identifier for this menu item.

## ◆ on_click()

 virtual void xtd::forms::menu_item::on_click ( const event_args & e )
protectedvirtual

Raises the Click event.

Parameters
 e An xtd::event_args that contains the event data.
Remarks
Raising an event invokes the event handler through a delegate.

## ◆ perform_click()

Generates a xtd::forms::menu_item::click event for the xtd::forms::menu_item, simulating a click by a user.

Remarks
You can use this menu to activate a menu item through code without passing any event information. For example, if you want to activate a menu item based on an action that occurs in your application, you can call the xtd::forms::menu_item::perform_click method for that xtd::forms::menu_item.

## ◆ shortcut() [1/2]

inline

Gets a value indicating the shortcut key associated with the menu item.

Returns
One of the xtd::forms::shortcut values. The default is xtd::forms::shortcut::none.

## ◆ shortcut() [2/2]

Sets a value indicating the shortcut key associated with the menu item.

Parameters
 value One of the xtd::forms::shortcut values. The default is xtd::forms::shortcut::none.
Returns

## ◆ text() [1/2]

 const xtd::ustring& xtd::forms::menu_item::text ( ) const
inline

Gets a value indicating the caption of the menu item.

Returns
The text caption of the menu item.
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

## ◆ text() [2/2]

Sets a value indicating the caption of the menu item.

Parameters
 value The text caption of the menu item.
Returns
Remarks
When you specify a caption for your menu item with the text parameter, you can also specify an access key by placing an '&' before the character to be used as the access key. For example, to specify the "F" in "File" as an access key, you would specify the caption for the menu item as "&File". You can use this feature to provide keyboard navigation for your menus.
Setting the text parameter to "-" causes your menu item to be displayed as a separator (a horizontal line) rather than a standard menu item.

## ◆ to_string()

overridevirtualnoexcept

Returns a string that represents the menu control.

Returns
A string that represents the current menu.
Remarks
The to_string method returns a string that includes the type and the number of items in the menu_items property of the control.