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