wxMenuEvent(3erl)
π wxMenuEvent π
okay so bestie, this is the wxMenuEvent page from the Erlang Module Definition manual (section 3erl) β and it's literally all about the wxMenuEvent class. it's giving main character energy, no cap β¨
π NAME π
wxMenuEvent - Functions for wxMenuEvent class
β¨ DESCRIPTION β¨
so this class is used for a variety of menu-related events β like, a whole little menu-event ecosystem π
. Note that these do not include menu command events, because those are handled using wxCommandEvent objects. lowkey important, okay? okay.
okay so events of this class are generated by both menus that are part of a wxMenuBar, attached to wxFrame, and popup menus shown by wxWindow:popupMenu/4. They get sent to these objects in order, until one of them handles the event:
- The menu object itself, as returned by
GetMenu(), if any. - The
wxMenuBarto which this menu is attached, if any. - The window associated with the menu, e.g. the one calling
PopupMenu()for the popup menus. - The top level parent of that window if it's different from the window itself.
this is similar to command events generated by the menu items, but β plot twist β unlike them, wxMenuEvent events are only sent to the window itself and its top level parent, not any intermediate windows in the hierarchy. periodt.
the default handler for wxEVT_MENU_HIGHLIGHT in wxFrame displays help text in the status bar, see wxFrame:setStatusBarPane/2 β cute, right? π
See: wxCommandEvent, Overview events
this class is derived (and can use functions) from: wxEvent β family functions included, iykyk π
wxWidgets docs: wxMenuEvent
π EVENTS π
Use wxEvtHandler:connect/3 with wxMenuEventType to subscribe to events of this type β that's the whole vibe, bestie π¦
π§ DATA TYPES π§
here's the type tea π΅:
wxMenuEvent() = wx:wx_object()
wxMenu() =
#wxMenu{type = wxMenuEvent:wxMenuEventType(),
menuId = integer(),
menu = wxMenu:wxMenu()}
wxMenuEventType() = menu_open | menu_close | menu_highlight
π EXPORTS π
getMenu(This) -> wxMenu:wxMenu()
Types:
This = wxMenuEvent()
returns the menu which is being opened or closed, or the menu containing the highlighted item β iconic behavior π
Note: the returned value can be NULL if the menu being opened doesn't have a corresponding wxMenu, e.g. this happens when opening the system menu in wxMSW port. so yeah, handle that with care π«Ά
Remark: since 3.1.3 this function can be used with OPEN, CLOSE and HIGHLIGHT events. Before 3.1.3, this method can only be used with the OPEN and CLOSE events.
getMenuId(This) -> integer()
Types:
This = wxMenuEvent()
returns the menu identifier associated with the event β periodt.
this method should be only used with the HIGHLIGHT events. don't get it twisted π
isPopup(This) -> boolean()
Types:
This = wxMenuEvent()
returns true if the menu which is being opened or closed is a popup menu, false if it is a normal one β slay.
this method should only be used with the OPEN and CLOSE events. okay bestie? okay π
big shoutout to the wxWidgets team β source/version: wx 2.2.2.1; the footer doesn't give a date, so no cap, we're not inventing one. bye bestie π«Άβ¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms