wxRuby Documentation Home


This class is used to represent a variety of menu-related events such as highlighting, opening and closing items. Note that the commonest event to be handled from menus – that of actually choosing a menu item – is not a MenuEvent but a CommandEvent, captured by using evt_menu.

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

Derived from



Event table macros

To process a menu event, use these event handler macros to direct input to member functions that take a MenuEvent argument. They can only be processed by a menubar’s frame.

evt_menu_open() { | event | ... } 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() { | event | ... } A menu has been just closed.
evt_menu_highlight(id) { | event | ... } The menu item with thespecified id has been highlighted: used to show help prompts in the status barby Frame
evt_menu_highlight_all() { | event | ... } A menu item has beenhighlighted, i.e. the currently selected menu item has changed.

See also

Command events,

Event handling overview


MenuEvent.new(TYPE id = 0,  Integer id = 0,  Menu menu = nil)


Menu get_menu()

Returns the menu which is being opened or closed. This method should only be used with the OPEN and CLOSE events.

Integer get_menu_id()

Returns the menu identifier associated with the event. This method should be only used with the HIGHLIGHT events.

Boolean is_popup()

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.

[This page automatically generated from the Textile source at Wed Sep 09 02:21:17 +0100 2009]