]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/cmdevent.tex
A fix for attribrute sorting, but it's still broken if there are
[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
10\wxheading{Include files}
11
12<wx/event.h>
13
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
21\twocolitem{{\bf EVT\_COMMAND(id, event, func)}}{Process a command, supplying the window identifier,
22command event identifier, and member function.}
23\twocolitem{{\bf EVT\_COMMAND\_RANGE(id1, id2, event, func)}}{Process a command for a range
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.}
34\twocolitem{{\bf EVT\_LISTBOX\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_DOUBLECLICKED command,
35which is generated by a wxListBox control.}
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,
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.}
42\twocolitem{{\bf EVT\_MENU(id, func)}}{Process a wxEVT\_COMMAND\_MENU\_SELECTED command,
43which is generated by a menu item.}
44\twocolitem{{\bf EVT\_MENU\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_MENU\_RANGE command,
45which is generated by a range of menu items.}
46\twocolitem{{\bf EVT\_SLIDER(id, func)}}{Process a wxEVT\_COMMAND\_SLIDER\_UPDATED command,
47which is generated by a wxSlider control.}
48\twocolitem{{\bf EVT\_RADIOBOX(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBOX\_SELECTED command,
49which is generated by a wxRadioBox control.}
50\twocolitem{{\bf EVT\_RADIOBUTTON(id, func)}}{Process a wxEVT\_COMMAND\_RADIOBUTTON\_SELECTED command,
51which is generated by a wxRadioButton control.}
52\twocolitem{{\bf EVT\_SCROLLBAR(id, func)}}{Process a wxEVT\_COMMAND\_SCROLLBAR\_UPDATED command,
53which is generated by a wxScrollBar control. This is provided for compatibility only;
54more specific scrollbar event macros should be used instead (see \helpref{wxScrollEvent}{wxscrollevent}).}
55\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED command,
56which is generated by a wxComboBox control.}
57\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
58(a synonym for wxEVT\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.}
59\twocolitem{{\bf EVT\_TOOL\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
60for a range id identifiers. Pass the ids of the tools.}
61\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event.
62Pass the id of the tool.}
63\twocolitem{{\bf EVT\_TOOL\_RCLICKED\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event
64for a range of ids. Pass the ids of the tools.}
65\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER event.
66Pass 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.}
67\twocolitem{{\bf EVT\_COMMAND\_LEFT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_CLICK command,
68which is generated by a control (Windows 95 and NT only).}
69\twocolitem{{\bf EVT\_COMMAND\_LEFT\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_DCLICK command,
70which is generated by a control (Windows 95 and NT only).}
71\twocolitem{{\bf EVT\_COMMAND\_RIGHT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_RIGHT\_CLICK command,
72which is generated by a control (Windows 95 and NT only).}
73\twocolitem{{\bf EVT\_COMMAND\_SET\_FOCUS(id, func)}}{Process a wxEVT\_COMMAND\_SET\_FOCUS command,
74which is generated by a control (Windows 95 and NT only).}
75\twocolitem{{\bf EVT\_COMMAND\_KILL\_FOCUS(id, func)}}{Process a wxEVT\_COMMAND\_KILL\_FOCUS command,
76which is generated by a control (Windows 95 and NT only).}
77\twocolitem{{\bf EVT\_COMMAND\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_ENTER command,
78which is generated by a control.}
79\end{twocollist}%
80
81\latexignore{\rtfignore{\wxheading{Members}}}
82
83\membersection{wxCommandEvent::m\_clientData}
84
85\member{void*}{m\_clientData}
86
87Contains a pointer to client data for listboxes and choices, if the event
88was a selection. Beware, this is not implemented anyway...
89
90\membersection{wxCommandEvent::m\_commandInt}
91
92\member{int}{m\_commandInt}
93
94Contains an integer identifier corresponding to a listbox, choice or
95radiobox selection (only if the event was a selection, not a
96deselection), or a boolean value representing the value of a checkbox.
97
98\membersection{wxCommandEvent::m\_commandString}
99
100\member{char*}{m\_commandString}
101
102Contains a string corresponding to a listbox or choice selection.
103
104\membersection{wxCommandEvent::m\_extraLong}
105
106\member{long}{m\_extraLong}
107
108Extra information. If the event comes from a listbox selection, it is
109a boolean determining whether the event was a selection (TRUE) or a
110deselection (FALSE). A listbox deselection only occurs for
111multiple-selection boxes, and in this case the index and string values
112are indeterminate and the listbox must be examined by the application.
113
114\membersection{wxCommandEvent::wxCommandEvent}
115
116\func{}{wxCommandEvent}{\param{WXTYPE}{ commandEventType = 0}, \param{int}{ id = 0}}
117
118Constructor.
119
120\membersection{wxCommandEvent::Checked}
121
122\constfunc{bool}{Checked}{\void}
123
124Deprecated, use \helpref{IsChecked}{wxcommandeventischecked} instead.
125
126\membersection{wxCommandEvent::GetClientData}
127
128\func{void*}{GetClientData}{\void}
129
130Returns client data pointer for a listbox or choice selection event
131(not valid for a deselection).
132
133\membersection{wxCommandEvent::GetExtraLong}
134
135\func{long}{GetExtraLong}{\void}
136
137Returns the {\bf m\_extraLong} member.
138
139\membersection{wxCommandEvent::GetInt}
140
141\func{int}{GetInt}{\void}
142
143Returns the {\bf m\_commandInt} member.
144
145\membersection{wxCommandEvent::GetSelection}
146
147\func{int}{GetSelection}{\void}
148
149Returns item index for a listbox or choice selection event (not valid for
150a deselection).
151
152\membersection{wxCommandEvent::GetString}
153
154\func{char*}{GetString}{\void}
155
156Returns item string for a listbox or choice selection event (not valid for
157a deselection).
158
159\membersection{wxCommandEvent::IsChecked}\label{wxcommandeventischecked}
160
161\constfunc{bool}{IsChecked}{\void}
162
163This method can be used with checkbox and menu events: for the checkboxes, the
164method returns {\tt TRUE} for a selection event and {\tt FALSE} for a
165deselection one. For the menu events, this method indicates if the menu item
166just has become checked or unchecked (and thus only makes sense for checkable
167menu items).
168
169\membersection{wxCommandEvent::IsSelection}
170
171\func{bool}{IsSelection}{\void}
172
173For a listbox or choice event, returns TRUE if it is a selection, FALSE if it
174is a deselection.
175
176\membersection{wxCommandEvent::SetClientData}
177
178\func{void}{SetClientData}{\param{void*}{ clientData}}
179
180Sets the client data for this event.
181
182\membersection{wxCommandEvent::SetExtraLong}
183
184\func{void}{SetExtraLong}{\param{int}{ extraLong}}
185
186Sets the {\bf m\_extraLong} member.
187
188\membersection{wxCommandEvent::SetInt}
189
190\func{void}{SetInt}{\param{int}{ intCommand}}
191
192Sets the {\bf m\_commandInt} member.
193
194\membersection{wxCommandEvent::SetString}
195
196\func{void}{SetString}{\param{char*}{ string}}
197
198Sets the {\bf m\_commandString} member.
199