1 \section{\class{wxCommandEvent
}}\label{wxcommandevent
}
3 This event class contains information about command events, which originate from a variety of
4 simple controls. More complex controls, such as
\helpref{wxTreeCtrl
}{wxtreectrl
}, have separate command event classes.
6 \wxheading{Derived from
}
8 \helpref{wxEvent
}{wxevent
}
10 \wxheading{Include files
}
14 \wxheading{Event table macros
}
16 To process a menu command event, use these event handler macros to direct input to member
17 functions that take a wxCommandEvent argument.
20 \begin{twocollist
}\itemsep=
0pt
21 \twocolitem{{\bf EVT
\_COMMAND(id, event, func)
}}{Process a command, supplying the window identifier,
22 command event identifier, and member function.
}
23 \twocolitem{{\bf EVT
\_COMMAND\_RANGE(id1, id2, event, func)
}}{Process a command for a range
24 of window identifiers, supplying the minimum and maximum window identifiers,
25 command event identifier, and member function.
}
26 \twocolitem{{\bf EVT
\_BUTTON(id, func)
}}{Process a wxEVT
\_COMMAND\_BUTTON\_CLICKED command,
27 which is generated by a wxButton control.
}
28 \twocolitem{{\bf EVT
\_CHECKBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_CHECKBOX\_CLICKED command,
29 which is generated by a wxCheckBox control.
}
30 \twocolitem{{\bf EVT
\_CHOICE(id, func)
}}{Process a wxEVT
\_COMMAND\_CHOICE\_SELECTED command,
31 which is generated by a wxChoice control.
}
32 \twocolitem{{\bf EVT
\_LISTBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_LISTBOX\_SELECTED command,
33 which is generated by a wxListBox control.
}
34 \twocolitem{{\bf EVT
\_LISTBOX\_DCLICK(id, func)
}}{Process a wxEVT
\_COMMAND\_LISTBOX\_DOUBLECLICKED command,
35 which is generated by a wxListBox control.
}
36 \twocolitem{{\bf EVT
\_TEXT(id, func)
}}{Process a wxEVT
\_COMMAND\_TEXT\_UPDATED command,
37 which is generated by a wxTextCtrl control.
}
38 \twocolitem{{\bf EVT
\_TEXT\_ENTER(id, func)
}}{Process a wxEVT
\_COMMAND\_TEXT\_ENTER command,
39 which is generated by a wxTextCtrl control.
}
40 \twocolitem{{\bf EVT
\_MENU(id, func)
}}{Process a wxEVT
\_COMMAND\_MENU\_SELECTED command,
41 which is generated by a menu item.
}
42 \twocolitem{{\bf EVT
\_MENU\_RANGE(id1, id2, func)
}}{Process a wxEVT
\_COMMAND\_MENU\_RANGE command,
43 which is generated by a range of menu items.
}
44 \twocolitem{{\bf EVT
\_SLIDER(id, func)
}}{Process a wxEVT
\_COMMAND\_SLIDER\_UPDATED command,
45 which is generated by a wxSlider control.
}
46 \twocolitem{{\bf EVT
\_RADIOBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_RADIOBOX\_SELECTED command,
47 which is generated by a wxRadioBox control.
}
48 \twocolitem{{\bf EVT
\_RADIOBUTTON(id, func)
}}{Process a wxEVT
\_COMMAND\_RADIOBUTTON\_SELECTED command,
49 which is generated by a wxRadioButton control.
}
50 \twocolitem{{\bf EVT
\_SCROLLBAR(id, func)
}}{Process a wxEVT
\_COMMAND\_SCROLLBAR\_UPDATED command,
51 which is generated by a wxScrollBar control. This is provided for compatibility only;
52 more specific scrollbar event macros should be used instead (see
\helpref{wxScrollEvent
}{wxscrollevent
}).
}
53 \twocolitem{{\bf EVT
\_COMBOBOX(id, func)
}}{Process a wxEVT
\_COMMAND\_COMBOBOX\_SELECTED command,
54 which is generated by a wxComboBox control.
}
55 \twocolitem{{\bf EVT
\_TOOL(id, func)
}}{Process a wxEVT
\_COMMAND\_TOOL\_CLICKED event
56 (a synonym for wxEVT
\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.
}
57 \twocolitem{{\bf EVT
\_TOOL\_RANGE(id1, id2, func)
}}{Process a wxEVT
\_COMMAND\_TOOL\_CLICKED event
58 for a range id identifiers. Pass the ids of the tools.
}
59 \twocolitem{{\bf EVT
\_TOOL\_RCLICKED(id, func)
}}{Process a wxEVT
\_COMMAND\_TOOL\_RCLICKED event.
60 Pass the id of the tool.
}
61 \twocolitem{{\bf EVT
\_TOOL\_RCLICKED\_RANGE(id1, id2, func)
}}{Process a wxEVT
\_COMMAND\_TOOL\_RCLICKED event
62 for a range of ids. Pass the ids of the tools.
}
63 \twocolitem{{\bf EVT
\_TOOL\_ENTER(id, func)
}}{Process a wxEVT
\_COMMAND\_TOOL\_ENTER event.
64 Pass the id of the toolbar itself. The value of wxCommandEvent::GetSelection is the tool id, or -
1 if the mouse cursor has moved off a tool.
}
65 \twocolitem{{\bf EVT
\_COMMAND\_LEFT\_CLICK(id, func)
}}{Process a wxEVT
\_COMMAND\_LEFT\_CLICK command,
66 which is generated by a control (Windows
95 and NT only).
}
67 \twocolitem{{\bf EVT
\_COMMAND\_LEFT\_DCLICK(id, func)
}}{Process a wxEVT
\_COMMAND\_LEFT\_DCLICK command,
68 which is generated by a control (Windows
95 and NT only).
}
69 \twocolitem{{\bf EVT
\_COMMAND\_RIGHT\_CLICK(id, func)
}}{Process a wxEVT
\_COMMAND\_RIGHT\_CLICK command,
70 which is generated by a control (Windows
95 and NT only).
}
71 \twocolitem{{\bf EVT
\_COMMAND\_SET\_FOCUS(id, func)
}}{Process a wxEVT
\_COMMAND\_SET\_FOCUS command,
72 which is generated by a control (Windows
95 and NT only).
}
73 \twocolitem{{\bf EVT
\_COMMAND\_KILL\_FOCUS(id, func)
}}{Process a wxEVT
\_COMMAND\_KILL\_FOCUS command,
74 which is generated by a control (Windows
95 and NT only).
}
75 \twocolitem{{\bf EVT
\_COMMAND\_ENTER(id, func)
}}{Process a wxEVT
\_COMMAND\_ENTER command,
76 which is generated by a control.
}
79 \latexignore{\rtfignore{\wxheading{Members
}}}
81 \membersection{wxCommandEvent::m
\_clientData}
83 \member{void*
}{m
\_clientData}
85 Contains a pointer to client data for listboxes and choices, if the event
86 was a selection. Beware, this is not implemented anyway...
88 \membersection{wxCommandEvent::m
\_commandInt}
90 \member{int
}{m
\_commandInt}
92 Contains an integer identifier corresponding to a listbox, choice or
93 radiobox selection (only if the event was a selection, not a
94 deselection), or a boolean value representing the value of a checkbox.
96 \membersection{wxCommandEvent::m
\_commandString}
98 \member{char*
}{m
\_commandString}
100 Contains a string corresponding to a listbox or choice selection.
102 \membersection{wxCommandEvent::m
\_extraLong}
104 \member{long
}{m
\_extraLong}
106 Extra information. If the event comes from a listbox selection, it is
107 a boolean determining whether the event was a selection (TRUE) or a
108 deselection (FALSE). A listbox deselection only occurs for
109 multiple-selection boxes, and in this case the index and string values
110 are indeterminate and the listbox must be examined by the application.
112 \membersection{wxCommandEvent::wxCommandEvent
}
114 \func{}{wxCommandEvent
}{\param{WXTYPE
}{ commandEventType =
0},
\param{int
}{ id =
0}}
118 \membersection{wxCommandEvent::Checked
}
120 \func{bool
}{Checked
}{\void}
122 Returns TRUE or FALSE for a checkbox selection event.
124 \membersection{wxCommandEvent::GetClientData
}
126 \func{void*
}{GetClientData
}{\void}
128 Returns client data pointer for a listbox or choice selection event
129 (not valid for a deselection). Beware, this is not implmented anywhere...
131 \membersection{wxCommandEvent::GetExtraLong
}
133 \func{long
}{GetExtraLong
}{\void}
135 Returns the
{\bf m
\_extraLong} member.
137 \membersection{wxCommandEvent::GetInt
}
139 \func{int
}{GetInt
}{\void}
141 Returns the
{\bf m
\_commandInt} member.
143 \membersection{wxCommandEvent::GetSelection
}
145 \func{int
}{GetSelection
}{\void}
147 Returns item index for a listbox or choice selection event (not valid for
150 \membersection{wxCommandEvent::GetString
}
152 \func{char*
}{GetString
}{\void}
154 Returns item string for a listbox or choice selection event (not valid for
157 \membersection{wxCommandEvent::IsSelection
}
159 \func{bool
}{IsSelection
}{\void}
161 For a listbox or choice event, returns TRUE if it is a selection, FALSE if it
164 \membersection{wxCommandEvent::SetClientData
}
166 \func{void
}{SetClientData
}{\param{void*
}{ clientData
}}
168 Sets the client data for this event.
170 \membersection{wxCommandEvent::SetExtraLong
}
172 \func{void
}{SetExtraLong
}{\param{int
}{ extraLong
}}
174 Sets the
{\bf m
\_extraLong} member.
176 \membersection{wxCommandEvent::SetInt
}
178 \func{void
}{SetInt
}{\param{int
}{ intCommand
}}
180 Sets the
{\bf m
\_commandInt} member.
182 \membersection{wxCommandEvent::SetString
}
184 \func{void
}{SetString
}{\param{char*
}{ string
}}
186 Sets the
{\bf m
\_commandString} member.