Enter search terms or a module, class or function name.
This class is used for context menu events, sent to give the application a chance to show a context (popup) menu for a Window.
Note that if ContextMenuEvent.GetPosition returns DefaultPosition, this means that the event originated from a keyboard context button event, and you should compute a suitable position yourself, for example by calling GetMousePosition.
When a keyboard context menu button is pressed on Windows, a right-click event with default position is sent first, and if this event is not processed, the context menu event is sent. So if you process mouse events and you find your context menu event handler is not being called, you could call Event.Skip for mouse right-down events.
Handlers bound for the following event types will receive a ContextMenuEvent parameter.
See also
__init__ | Constructor. |
GetPosition | Returns the position in screen coordinates at which the menu should be shown. |
SetPosition | Sets the position at which the menu should be shown. |
This class is used for context menu events, sent to give the application a chance to show a context (popup) menu for a Window.
Possible constructors:
ContextMenuEvent(type=wxEVT_NULL, id=0, pos=DefaultPosition)
Constructor.
Parameters: |
|
---|
Returns the position in screen coordinates at which the menu should be shown.
Use Window.ScreenToClient to convert to client coordinates.
You can also omit a position from Window.PopupMenu 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 DefaultPosition.
Return type: | Point |
---|
Sets the position at which the menu should be shown.
Parameters: | point (Point) – |
---|
See GetPosition and SetPosition