wxContextMenuEvent(3erl)

πŸ¦‹ wxContextMenuEvent (3erl) πŸ¦‹

Erlang Module Definition, bestie β€” yes, that's the manual vibe. We're doing wxContextMenuEvent, and it's giving "context menu but make it Erlang." πŸ’…

🌸 NAME 🌸

wxContextMenuEvent β€” Functions for wxContextMenuEvent class. Periodt. ✨

✨ DESCRIPTION ✨

This class is used for context menu events β€” they get sent to give your application a chance to show a context (popup) menu for a wxWindow. Main character energy, honestly. πŸŽ€

πŸ’‘ Note: if getPosition/1 returns wxDefaultPosition, that means the event originated from a keyboard context button event. You should compute a suitable position yourself, for example by calling wx_misc:getMousePosition/0. Your move, bestie. 🫢

Notice that the exact sequence of mouse events is different across the platforms. For example, under MSW the context menu event is generated after EVT_RIGHT_UP event and only if it was not handled; but under GTK the context menu event is generated after EVT_RIGHT_DOWN event. This is correct in the sense that it ensures the context menu is shown according to the current platform UI conventions. And it also means that you must not handle β€” or call wxEvent:skip/2 in your handler if you do have one β€” neither right mouse down nor right mouse up event if you plan on handling EVT_CONTEXT_MENU event. 😭 This is the vibe check: platform mouse behavior is different, so don't fight it. πŸ’€

  • πŸ‘‰ See: wxCommandEvent, Overview events.
  • 🧬 This class is derived (and can use functions) from: wxCommandEvent, wxEvent.
  • πŸ“š wxWidgets docs: wxContextMenuEvent.

πŸŽ‰ EVENTS πŸŽ‰

Use wxEvtHandler:connect/3 with wxContextMenuEventType to subscribe to events of this type. Literally that's the whole section, but it's important, okay? πŸ’–

🧚 DATA TYPES 🧚

These are the types, bestie β€” keep them exactly as they are:

wxContextMenuEvent() = wx:wx_object()

wxContextMenu() =
    #wxContextMenu{type =
                       wxContextMenuEvent:wxContextMenuEventType(),
                   pos = {X :: integer(), Y :: integer()}}

wxContextMenuEventType() = context_menu

πŸ‘‘ EXPORTS πŸ‘‘

πŸ’– getPosition(This) πŸ’–

getPosition(This) -> {X :: integer(), Y :: integer()}

Types:

This = wxContextMenuEvent()

This one returns the position in screen coordinates at which the menu should be shown. πŸ–₯️ Use wxWindow:screenToClient/2 to convert to client coordinates. You can also omit a position from wxWindow:popupMenu/4 in order to use the current mouse pointer position. If the event originated from a keyboard event, the value returned from this function will be wxDefaultPosition. Keyboard girlies, heads up. πŸ’…

πŸ’– setPosition(This, Point) πŸ’–

setPosition(This, Point) -> ok

Types:

This = wxContextMenuEvent()
Point = {X :: integer(), Y :: integer()}

Sets the position at which the menu should be shown. Slay. ✨


Ok bye bestie β€” source/version vibes: the wxWidgets team, wx 2.2.2.1, and the manual tag wxContextMenuEvent(3erl). That's the footer energy. πŸ’–βœ¨

πŸ“¦ where this page comes from