Class: Wx::ContextMenuEvent
- Inherits:
-
CommandEvent
- Object
- Object
- Event
- CommandEvent
- Wx::ContextMenuEvent
- Defined in:
- lib/wx/doc/gen/events.rb
Overview
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 #get_position returns DEFAULT_POSITION, this means that the event originated from a keyboard context button event, and you should compute a suitable position yourself, for example by calling get_mouse_position. 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 that the context menu is shown according to the current platform UI conventions and also means that you must not handle (or call Event#skip 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.
Events using this class
The following event-handler methods redirect the events to member method or handler blocks for ContextMenuEvent events. Event handler methods:
-
EvtHandler#evt_context_menu(meth = nil, &block): A right click (or other context menu command depending on platform) has been detected.
Category: Events
Instance Method Summary collapse
-
#get_position ⇒ Wx::Point
(also: #position)
Returns the position in screen coordinates at which the menu should be shown.
-
#initialize(type = Wx::EVT_NULL, id = 0, pos = Wx::DEFAULT_POSITION) ⇒ Wx::ContextMenuEvent
constructor
Constructor.
-
#set_position(point) ⇒ void
(also: #position=)
Sets the position at which the menu should be shown.
Methods inherited from CommandEvent
#client_data, #client_data=, #get_client_data, #get_client_object, #get_int, #get_selection, #get_string, #is_checked, #is_selection, #set_client_data, #set_client_object, #set_extra_long, #set_int, #set_string
Methods inherited from Event
#clone, #get_event_category, #get_event_object, #get_event_type, #get_id, #get_skipped, #get_timestamp, #is_command_event, #resume_propagation, #set_event_object, #set_event_type, #set_id, #set_timestamp, #should_propagate, #skip, #stop_propagation
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize(type = Wx::EVT_NULL, id = 0, pos = Wx::DEFAULT_POSITION) ⇒ Wx::ContextMenuEvent
Constructor.
2769 |
# File 'lib/wx/doc/gen/events.rb', line 2769 def initialize(type=Wx::EVT_NULL, id=0, pos=Wx::DEFAULT_POSITION) end |
Instance Method Details
#get_position ⇒ Wx::Point Also known as: position
Returns the position in screen coordinates at which the menu should be shown.
Use Window#screen_to_client to convert to client coordinates. You can also omit a position from Window#popup_menu 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 DEFAULT_POSITION.
2777 |
# File 'lib/wx/doc/gen/events.rb', line 2777 def get_position; end |
#set_position(point) ⇒ void Also known as: position=
This method returns an undefined value.
Sets the position at which the menu should be shown.
2783 |
# File 'lib/wx/doc/gen/events.rb', line 2783 def set_position(point) end |