]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/cmdevent.tex
reSWIGged
[wxWidgets.git] / docs / latex / wx / cmdevent.tex
CommitLineData
a660d684
KB
1\section{\class{wxCommandEvent}}\label{wxcommandevent}
2
3This event class contains information about command events, which originate from a variety of
4simple controls. More complex controls, such as \helpref{wxTreeCtrl}{wxtreectrl}, have separate command event classes.
5
6\wxheading{Derived from}
7
8\helpref{wxEvent}{wxevent}
9
954b8ae6
JS
10\wxheading{Include files}
11
12<wx/event.h>
13
a660d684
KB
14\wxheading{Event table macros}
15
16To process a menu command event, use these event handler macros to direct input to member
17functions that take a wxCommandEvent argument.
18
19\twocolwidtha{7cm}
20\begin{twocollist}\itemsep=0pt
1f112209 21\twocolitem{{\bf EVT\_COMMAND(id, event, func)}}{Process a command, supplying the window identifier,
a660d684 22command event identifier, and member function.}
1f112209 23\twocolitem{{\bf EVT\_COMMAND\_RANGE(id1, id2, event, func)}}{Process a command for a range
a660d684
KB
24of window identifiers, supplying the minimum and maximum window identifiers,
25command event identifier, and member function.}
26\twocolitem{{\bf EVT\_BUTTON(id, func)}}{Process a wxEVT\_COMMAND\_BUTTON\_CLICKED command,
27which is generated by a wxButton control.}
28\twocolitem{{\bf EVT\_CHECKBOX(id, func)}}{Process a wxEVT\_COMMAND\_CHECKBOX\_CLICKED command,
29which is generated by a wxCheckBox control.}
30\twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED command,
31which is generated by a wxChoice control.}
32\twocolitem{{\bf EVT\_LISTBOX(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_SELECTED command,
33which is generated by a wxListBox control.}
e14dccff 34\twocolitem{{\bf EVT\_LISTBOX\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_DOUBLECLICKED command,
debe6624 35which is generated by a wxListBox control.}
a660d684
KB
36\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED command,
37which is generated by a wxTextCtrl control.}
38\twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_ENTER command,
3ca6a5f0
BP
39which is generated by a wxTextCtrl control. Note that you must use
40wxTE\_PROCESS\_ENTER flag when creating the control if you want it to generate
41such events.}
d7eee191
VZ
42\twocolitem{{\bf EVT\_TEXT\_MAXLEN(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_MAXLEN command,
43which is generated by a wxTextCtrl control when the user tries to enter more
2edb0bde 44characters into it than the limit previously set with
d7eee191 45\helpref{SetMaxLength}{wxtextctrlsetmaxlength}.}
a660d684
KB
46\twocolitem{{\bf EVT\_MENU(id, func)}}{Process a wxEVT\_COMMAND\_MENU\_SELECTED command,
47which is generated by a menu item.}
48\twocolitem{{\bf EVT\_MENU\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_MENU\_RANGE command,
49which is generated by a range of menu items.}
ccef86c7
VZ
50\twocolitem{{\bf EVT\_CONTEXT\_MENU(func)}}{Process the event generated
51when the user has requested a popup menu to appear by pressing a special
52keyboard key (under Windows) or by right clicking the mouse.}
a660d684
KB
53\twocolitem{{\bf EVT\_SLIDER(id, func)}}{Process a wxEVT\_COMMAND\_SLIDER\_UPDATED command,
54which is generated by a wxSlider control.}
55\twocolitem{{\bf EVT\_RADIOBOX(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBOX\_SELECTED command,
56which is generated by a wxRadioBox control.}
57\twocolitem{{\bf EVT\_RADIOBUTTON(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBUTTON\_SELECTED command,
58which is generated by a wxRadioButton control.}
59\twocolitem{{\bf EVT\_SCROLLBAR(id, func)}}{Process a wxEVT\_COMMAND\_SCROLLBAR\_UPDATED command,
60which is generated by a wxScrollBar control. This is provided for compatibility only;
61more specific scrollbar event macros should be used instead (see \helpref{wxScrollEvent}{wxscrollevent}).}
62\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED command,
63which is generated by a wxComboBox control.}
81d66cf3
JS
64\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
65(a synonym for wxEVT\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.}
66\twocolitem{{\bf EVT\_TOOL\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
156194e1 67for a range of identifiers. Pass the ids of the tools.}
81d66cf3
JS
68\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event.
69Pass the id of the tool.}
70\twocolitem{{\bf EVT\_TOOL\_RCLICKED\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event
71for a range of ids. Pass the ids of the tools.}
72\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER event.
73Pass 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.}
a660d684
KB
74\twocolitem{{\bf EVT\_COMMAND\_LEFT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_CLICK command,
75which is generated by a control (Windows 95 and NT only).}
76\twocolitem{{\bf EVT\_COMMAND\_LEFT\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_DCLICK command,
77which is generated by a control (Windows 95 and NT only).}
78\twocolitem{{\bf EVT\_COMMAND\_RIGHT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_RIGHT\_CLICK command,
79which is generated by a control (Windows 95 and NT only).}
80\twocolitem{{\bf EVT\_COMMAND\_SET\_FOCUS(id, func)}}{Process a wxEVT\_COMMAND\_SET\_FOCUS command,
81which is generated by a control (Windows 95 and NT only).}
82\twocolitem{{\bf EVT\_COMMAND\_KILL\_FOCUS(id, func)}}{Process a wxEVT\_COMMAND\_KILL\_FOCUS command,
83which is generated by a control (Windows 95 and NT only).}
84\twocolitem{{\bf EVT\_COMMAND\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_ENTER command,
85which is generated by a control.}
86\end{twocollist}%
87
88\latexignore{\rtfignore{\wxheading{Members}}}
89
90\membersection{wxCommandEvent::m\_clientData}
91
9c884972 92\member{void*}{m\_clientData}
a660d684
KB
93
94Contains a pointer to client data for listboxes and choices, if the event
9c884972 95was a selection. Beware, this is not implemented anyway...
a660d684
KB
96
97\membersection{wxCommandEvent::m\_commandInt}
98
99\member{int}{m\_commandInt}
100
101Contains an integer identifier corresponding to a listbox, choice or
102radiobox selection (only if the event was a selection, not a
103deselection), or a boolean value representing the value of a checkbox.
104
105\membersection{wxCommandEvent::m\_commandString}
106
12c44eb5 107\member{wxString}{m\_commandString}
a660d684
KB
108
109Contains a string corresponding to a listbox or choice selection.
110
111\membersection{wxCommandEvent::m\_extraLong}
112
113\member{long}{m\_extraLong}
114
115Extra information. If the event comes from a listbox selection, it is
cc81d32f
VS
116a boolean determining whether the event was a selection (true) or a
117deselection (false). A listbox deselection only occurs for
a660d684
KB
118multiple-selection boxes, and in this case the index and string values
119are indeterminate and the listbox must be examined by the application.
120
121\membersection{wxCommandEvent::wxCommandEvent}
122
123\func{}{wxCommandEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
124
125Constructor.
126
127\membersection{wxCommandEvent::Checked}
128
3ca6a5f0 129\constfunc{bool}{Checked}{\void}
a660d684 130
3ca6a5f0 131Deprecated, use \helpref{IsChecked}{wxcommandeventischecked} instead.
a660d684
KB
132
133\membersection{wxCommandEvent::GetClientData}
134
9c884972 135\func{void*}{GetClientData}{\void}
a660d684
KB
136
137Returns client data pointer for a listbox or choice selection event
3ca6a5f0 138(not valid for a deselection).
a660d684 139
88eadcf2
VZ
140\membersection{wxCommandEvent::GetClientObject}
141
142\func{wxClientData *}{GetClientObject}{\void}
143
144Returns client object pointer for a listbox or choice selection event
145(not valid for a deselection).
146
a660d684
KB
147\membersection{wxCommandEvent::GetExtraLong}
148
149\func{long}{GetExtraLong}{\void}
150
151Returns the {\bf m\_extraLong} member.
152
153\membersection{wxCommandEvent::GetInt}
154
155\func{int}{GetInt}{\void}
156
157Returns the {\bf m\_commandInt} member.
158
159\membersection{wxCommandEvent::GetSelection}
160
161\func{int}{GetSelection}{\void}
162
163Returns item index for a listbox or choice selection event (not valid for
164a deselection).
165
166\membersection{wxCommandEvent::GetString}
167
ce788ad9 168\func{wxString}{GetString}{\void}
a660d684
KB
169
170Returns item string for a listbox or choice selection event (not valid for
171a deselection).
172
3ca6a5f0
BP
173\membersection{wxCommandEvent::IsChecked}\label{wxcommandeventischecked}
174
175\constfunc{bool}{IsChecked}{\void}
176
177This method can be used with checkbox and menu events: for the checkboxes, the
cc81d32f 178method returns {\tt true} for a selection event and {\tt false} for a
3ca6a5f0
BP
179deselection one. For the menu events, this method indicates if the menu item
180just has become checked or unchecked (and thus only makes sense for checkable
181menu items).
182
a660d684
KB
183\membersection{wxCommandEvent::IsSelection}
184
185\func{bool}{IsSelection}{\void}
186
cc81d32f 187For a listbox or choice event, returns true if it is a selection, false if it
a660d684
KB
188is a deselection.
189
190\membersection{wxCommandEvent::SetClientData}
191
9c884972 192\func{void}{SetClientData}{\param{void*}{ clientData}}
a660d684
KB
193
194Sets the client data for this event.
195
88eadcf2
VZ
196\membersection{wxCommandEvent::SetClientObject}
197
198\func{void}{SetClientObject}{\param{wxClientData*}{ clientObject}}
199
200Sets the client object for this event. The client object is \emph{not} owned by the event
201object and the event object will not delete the client object in its destructor.
202The client object must be owned and deleted by another object (e.g. a control)
203that has longer life time than the event object.
204
a660d684
KB
205\membersection{wxCommandEvent::SetExtraLong}
206
207\func{void}{SetExtraLong}{\param{int}{ extraLong}}
208
209Sets the {\bf m\_extraLong} member.
210
211\membersection{wxCommandEvent::SetInt}
212
213\func{void}{SetInt}{\param{int}{ intCommand}}
214
215Sets the {\bf m\_commandInt} member.
216
217\membersection{wxCommandEvent::SetString}
218
ce788ad9 219\func{void}{SetString}{\param{const wxString\&}{ string}}
a660d684
KB
220
221Sets the {\bf m\_commandString} member.
222