wxMenuEvent(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸŽ€ NAME πŸŽ€

wxMenuEvent β€” the class that handles a whole rainbow of menu-related events πŸ’–


✨ DESCRIPTION ✨

okay bestie, listen up. wxMenuEvent is used for a variety of menu-related events. that's the vibe.

but β€” and this is important β€” these do NOT include menu command events. those are a whole different girl and they're handled using wxCommandEvent objects. don't mix them up, i'm begging πŸ™

Events of this class get 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 the following objects, in order, until one of them handles the event πŸ‘‡

  1. The menu object itself, as returned by GetMenu(), if any.
  2. The wxMenuBar to which this menu is attached, if any.
  3. The window associated with the menu β€” e.g. the one calling PopupMenu() for the popup menus.
  4. 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, unlike them, wxMenuEvent are only sent to the window itself and its top level parent β€” not any of the intermediate windows in the hierarchy. no middlemen. periodt πŸ’…

The default handler for wxEVT_MENU_HIGHLIGHT in wxFrame displays help text in the status bar, see wxFrame:setStatusBarPane/2.

See:

  • wxCommandEvent
  • Overview events

This class is derived, and can use functions, from:

  • wxEvent

wxWidgets docs: wxMenuEvent 🌸

πŸ¦‹ Events πŸ¦‹

Use wxEvtHandler:connect/3 with wxMenuEventType to subscribe to events of this type. that's the whole ritual, go off ✨


πŸ’œ DATA TYPES πŸ’œ

wxMenu() :: #wxMenu{}.

wxMenuEvent() :: wx:wx_object().

wxMenuEventType() :: menu_open | menu_close | menu_highlight.

πŸ”₯ FUNCTIONS πŸ”₯

  • getMenu(This) -> wxMenu:wxMenu() when This :: wxMenuEvent().

Returns the menu which is being opened or closed, or the menu containing the highlighted item. very "which one of u is it" energy πŸ•΅οΈβ€β™€οΈ

Note that 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 like… check before u use it bestie 😭

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. glow-up confirmed ✨

  • getMenuId(This) -> integer() when This :: wxMenuEvent().

Returns the menu identifier associated with the event.

This method should be only used with the HIGHLIGHT events. it's picky like that πŸ™ˆ

  • isPopup(This) -> boolean() when This :: wxMenuEvent().

Returns true if the menu which is being opened or closed is a popup menu, false if it is a normal one. vibe check: popup or no πŸ’…

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


and that's the whole page, bestie β€” no cap, every flag and note accounted for 🫢

this lil masterpiece comes courtesy of Ericsson AB, sitting proudly in the wx 2.6 era, and it's officially the wxMenuEvent(3) page. tysm for reading, mwah πŸ’–

πŸ“¦ where this page comes from