Public Member Functions

# wxMenuEvent Class Reference
[Events]

`#include <wx/event.h>`

Inheritance diagram for wxMenuEvent:
[legend]

## Detailed Description

This class is used for a variety of menu-related events.

Note that these do not include menu command events, which are handled using wxCommandEvent objects.

The default handler for `wxEVT_MENU_HIGHLIGHT` displays help text in the first field of the status bar.

## Events using this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxMenuEvent& event)

Event macros:

- EVT_MENU_OPEN(func):
  A menu is about to be opened. On Windows, this is only sent once for each navigation of the menubar (up until all menus have closed).
- EVT_MENU_CLOSE(func):
  A menu has been just closed.
- EVT_MENU_HIGHLIGHT(id, func):
  The menu item with the specified id has been highlighted: used to show help prompts in the status bar by wxFrame
- EVT_MENU_HIGHLIGHT_ALL(func):
  A menu item has been highlighted, i.e. the currently selected menu item has changed.

##

Library: wxCore
Category: Events

See also:
  wxCommandEvent, Events and Event Handling

## Public Member Functions
| wxMenuEvent (wxEventType type=wxEVT_NULL, int id=0, wxMenu *menu=NULL)
| Constructor.
wxMenu * | GetMenu () const
| Returns the menu which is being opened or closed.
int | GetMenuId () const
| Returns the menu identifier associated with the event.
bool | IsPopup () const
| Returns true if the menu which is being opened or closed is a popup menu, false if it is a normal one.

List of all members.

## Constructor & Destructor Documentation

wxMenuEvent::wxMenuEvent | ( | wxEventType | type = `wxEVT_NULL`,
|  | int | id = `0`,
|  | wxMenu * | menu = `NULL` |
| ) |  |  |

Constructor.

## Member Function Documentation

wxMenu* wxMenuEvent::GetMenu | ( |  | ) | const

Returns the menu which is being opened or closed.

This method should only be used with the `OPEN` and `CLOSE` events and even for them the returned pointer may be NULL in some ports.

int wxMenuEvent::GetMenuId | ( |  | ) | const

Returns the menu identifier associated with the event.

This method should be only used with the `HIGHLIGHT` events.

bool wxMenuEvent::IsPopup | ( |  | ) | const

Returns true if the menu which is being opened or closed is a popup menu, false if it is a normal one.

This method should only be used with the `OPEN` and `CLOSE` events.

|  | [ top ]