Class: Wx::CommandEvent
- Defined in:
- lib/wx/doc/gen/event.rb,
lib/wx/doc/event.rb
Overview
This event class contains information about command events, which originate from a variety of simple controls.
Note that CommandEvents and CommandEvent-derived event classes by default and unlike other Event-derived classes propagate upward from the source window (the window which emits the event) up to the first parent which processes the event. Be sure to read How Events Propagate Upwards. More complex controls, such as TreeCtrl, have separate command event classes.
Events using this class
The following event-handler methods redirect the events to member method or handler blocks for CommandEvent events. Event handler methods:
-
EvtHandler#evt_command(id, event, meth = nil, &block): Process a command, supplying the window identifier, command event identifier, and member function.
-
EvtHandler#evt_command_range(id1, id2, event, meth = nil, &block): Process a command for a range of window identifiers, supplying the minimum and maximum window identifiers, command event identifier, and member function.
-
EvtHandler#evt_button(id, meth = nil, &block): Process a EVT_BUTTON command, which is generated by a Button control.
-
EvtHandler#evt_checkbox(id, meth = nil, &block): Process a EVT_CHECKBOX command, which is generated by a CheckBox control.
-
EvtHandler#evt_choice(id, meth = nil, &block): Process a EVT_CHOICE command, which is generated by a Choice control.
-
EvtHandler#evt_combobox(id, meth = nil, &block): Process a EVT_COMBOBOX command, which is generated by a ComboBox control.
-
EvtHandler#evt_listbox(id, meth = nil, &block): Process a EVT_LISTBOX command, which is generated by a ListBox control.
-
EvtHandler#evt_listbox_dclick(id, meth = nil, &block): Process a EVT_LISTBOX_DCLICK command, which is generated by a ListBox control.
-
EvtHandler#evt_checklistbox(id, meth = nil, &block): Process a EVT_CHECKLISTBOX command, which is generated by a CheckListBox control.
-
EvtHandler#evt_menu(id, meth = nil, &block): Process a EVT_MENU command, which is generated by a menu item.
-
EvtHandler#evt_menu_range(id1, id2, meth = nil, &block): Process a EVT_MENU command, which is generated by a range of menu items.
-
EvtHandler#evt_context_menu(meth = nil, &block): Process the event generated when the user has requested a popup menu to appear by pressing a special keyboard key (under Windows) or by right clicking the mouse.
-
EvtHandler#evt_radiobox(id, meth = nil, &block): Process a EVT_RADIOBOX command, which is generated by a RadioBox control.
-
EvtHandler#evt_radiobutton(id, meth = nil, &block): Process a EVT_RADIOBUTTON command, which is generated by a RadioButton control.
-
EvtHandler#evt_scrollbar(id, meth = nil, &block): Process a EVT_SCROLLBAR command, which is generated by a ScrollBar control. This is provided for compatibility only; more specific scrollbar event macros should be used instead (see ScrollEvent).
-
EvtHandler#evt_slider(id, meth = nil, &block): Process a EVT_SLIDER command, which is generated by a Slider control.
-
EvtHandler#evt_text(id, meth = nil, &block): Process a EVT_TEXT command, which is generated by a TextCtrl control.
-
EvtHandler#evt_text_enter(id, meth = nil, &block): Process a EVT_TEXT_ENTER command, which is generated by a TextCtrl control. Note that you must use TE_PROCESS_ENTER flag when creating the control if you want it to generate such events.
-
EvtHandler#evt_text_maxlen(id, meth = nil, &block): Process a EVT_TEXT_MAXLEN command, which is generated by a TextCtrl control when the user tries to enter more characters into it than the limit previously set with SetMaxLength().
-
EvtHandler#evt_togglebutton(id, meth = nil, &block): Process a EVT_TOGGLEBUTTON event.
-
EvtHandler#evt_tool(id, meth = nil, &block): Process a EVT_TOOL event (a synonym for EVT_MENU). Pass the id of the tool.
-
EvtHandler#evt_tool_range(id1, id2, meth = nil, &block): Process a EVT_TOOL event for a range of identifiers. Pass the ids of the tools.
-
EvtHandler#evt_tool_rclicked(id, meth = nil, &block): Process a EVT_TOOL_RCLICKED event. Pass the id of the tool. (Not available on WXOSX.)
-
EvtHandler#evt_tool_rclicked_range(id1, id2, meth = nil, &block): Process a EVT_TOOL_RCLICKED event for a range of ids. Pass the ids of the tools. (Not available on WXOSX.)
-
EvtHandler#evt_tool_enter(id, meth = nil, &block): Process a EVT_TOOL_ENTER event. Pass the id of the toolbar itself. The value of #get_selection is the tool id, or -1 if the mouse cursor has moved off a tool. (Not available on WXOSX.)
-
EvtHandler#evt_command_left_click(id, meth = nil, &block): Process a EVT_COMMAND_LEFT_CLICK command, which is generated by a control (WXMSW only).
-
EvtHandler#evt_command_left_dclick(id, meth = nil, &block): Process a EVT_COMMAND_LEFT_DCLICK command, which is generated by a control (WXMSW only).
-
EvtHandler#evt_command_right_click(id, meth = nil, &block): Process a EVT_COMMAND_RIGHT_CLICK command, which is generated by a control (WXMSW only).
-
EvtHandler#evt_command_set_focus(id, meth = nil, &block): Process a EVT_COMMAND_SET_FOCUS command, which is generated by a control (WXMSW only).
-
EvtHandler#evt_command_kill_focus(id, meth = nil, &block): Process a EVT_COMMAND_KILL_FOCUS command, which is generated by a control (WXMSW only).
-
EvtHandler#evt_command_enter(id, meth = nil, &block): Process a EVT_COMMAND_ENTER command, which is generated by a control.
Category: Events
Direct Known Subclasses
ChildFocusEvent, ClipboardTextEvent, CollapsiblePaneEvent, ColourPickerEvent, ContextMenuEvent, DateEvent, FileCtrlEvent, FileDirPickerEvent, FindDialogEvent, FontPickerEvent, GRID::GridEditorCreatedEvent, HTML::HtmlCellEvent, HTML::HtmlLinkEvent, HelpEvent, HyperlinkEvent, NotifyEvent, PG::PropertyGridEvent, RBN::RibbonButtonBarEvent, RBN::RibbonGalleryEvent, RBN::RibbonPanelEvent, RBN::RibbonToolBarEvent, STC::StyledTextEvent, SashEvent, ScrollEvent, UpdateUIEvent, WindowCreateEvent, WindowDestroyEvent
Instance Method Summary collapse
- #client_data ⇒ Object
- #client_data= ⇒ Object
- #get_client_data ⇒ Object
-
#get_client_object ⇒ Object
(also: #client_object)
Returns client object pointer for a listbox or choice selection event (not valid for a deselection).
-
#get_int ⇒ Integer
(also: #int)
Returns the integer identifier corresponding to a listbox, choice or radiobox selection (only if the event was a selection, not a deselection), or a boolean value representing the value of a checkbox.
-
#get_selection ⇒ Integer
(also: #selection)
Returns item index for a listbox or choice selection event (not valid for a deselection).
-
#get_string ⇒ String
(also: #string)
Returns item string for a listbox or choice selection event.
-
#initialize(commandEventType = Wx::EVT_NULL, id = 0) ⇒ Wx::CommandEvent
constructor
Constructor.
-
#is_checked ⇒ Boolean
(also: #checked?)
This method can be used with checkbox and menu events: for the checkboxes, the method returns true for a selection event and false for a deselection one.
-
#is_selection ⇒ Boolean
(also: #selection?)
For a listbox or similar event, returns true if it is a selection, false if it is a deselection.
- #set_client_data ⇒ Object
-
#set_client_object(clientObject) ⇒ void
Sets the client object for this event.
-
#set_extra_long(extraLong) ⇒ void
(also: #extra_long=)
Sets the m_extraLong member.
-
#set_int(intCommand) ⇒ void
(also: #int=)
Sets the m_commandInt member.
-
#set_string(string) ⇒ void
(also: #string=)
Sets the m_commandString member.
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(commandEventType = Wx::EVT_NULL, id = 0) ⇒ Wx::CommandEvent
Constructor.
884 |
# File 'lib/wx/doc/gen/event.rb', line 884 def initialize(commandEventType=Wx::EVT_NULL, id=0) end |
Instance Method Details
#client_data ⇒ Object
38 |
# File 'lib/wx/doc/event.rb', line 38 alias :client_data :get_client_object |
#client_data= ⇒ Object
34 |
# File 'lib/wx/doc/event.rb', line 34 alias :client_data= :set_client_object |
#get_client_data ⇒ Object
36 |
# File 'lib/wx/doc/event.rb', line 36 alias :get_client_data :get_client_object |
#get_client_object ⇒ Object Also known as: client_object
Returns client object pointer for a listbox or choice selection event (not valid for a deselection).
888 |
# File 'lib/wx/doc/gen/event.rb', line 888 def get_client_object; end |
#get_int ⇒ Integer Also known as: int
Returns the integer identifier corresponding to a listbox, choice or radiobox selection (only if the event was a selection, not a deselection), or a boolean value representing the value of a checkbox.
For a menu item, this method returns -1 if the item is not checkable or a boolean value (true or false) for checkable items indicating the new state of the item.
895 |
# File 'lib/wx/doc/gen/event.rb', line 895 def get_int; end |
#get_selection ⇒ Integer Also known as: selection
Returns item index for a listbox or choice selection event (not valid for a deselection).
900 |
# File 'lib/wx/doc/gen/event.rb', line 900 def get_selection; end |
#get_string ⇒ String Also known as: string
Returns item string for a listbox or choice selection event.
If one or several items have been deselected, returns the index of the first deselected item. If some items have been selected and others deselected at the same time, it will return the index of the first selected item.
907 |
# File 'lib/wx/doc/gen/event.rb', line 907 def get_string; end |
#is_checked ⇒ Boolean Also known as: checked?
This method can be used with checkbox and menu events: for the checkboxes, the method returns true for a selection event and false for a deselection one.
For the menu events, this method indicates if the menu item just has become checked or unchecked (and thus only makes sense for checkable menu items). Notice that this method cannot be used with Wx::CheckListBox currently.
915 |
# File 'lib/wx/doc/gen/event.rb', line 915 def is_checked; end |
#is_selection ⇒ Boolean Also known as: selection?
For a listbox or similar event, returns true if it is a selection, false if it is a deselection.
If some items have been selected and others deselected at the same time, it will return true.
922 |
# File 'lib/wx/doc/gen/event.rb', line 922 def is_selection; end |
#set_client_data ⇒ Object
32 |
# File 'lib/wx/doc/event.rb', line 32 alias :set_client_data :set_client_object |
#set_client_object(clientObject) ⇒ void
This method returns an undefined value.
Sets the client object for this event.
The client object is not owned by the event object and the event object will not delete the client object in its destructor. The client object must be owned and deleted by another object (e.g. a control) that has longer life time than the event object.
931 |
# File 'lib/wx/doc/gen/event.rb', line 931 def set_client_object(clientObject) end |
#set_extra_long(extraLong) ⇒ void Also known as: extra_long=
This method returns an undefined value.
Sets the m_extraLong member.
936 |
# File 'lib/wx/doc/gen/event.rb', line 936 def set_extra_long(extraLong) end |
#set_int(intCommand) ⇒ void Also known as: int=
This method returns an undefined value.
Sets the m_commandInt member.
942 |
# File 'lib/wx/doc/gen/event.rb', line 942 def set_int(intCommand) end |
#set_string(string) ⇒ void Also known as: string=
This method returns an undefined value.
Sets the m_commandString member.
948 |
# File 'lib/wx/doc/gen/event.rb', line 948 def set_string(string) end |