1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
|
<HTML>
<head><title>wxCommandEvent</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxcommandevent"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx51.htm#wxcommand"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx53.htm#wxcommandprocessor"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxCommandEvent</H2>
<P>
This event class contains information about command events, which originate from a variety of
simple controls. More complex controls, such as <A HREF="wx250.htm#wxtreectrl">wxTreeCtrl</A>, have separate command event classes.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx84.htm#wxevent">wxEvent</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/event.h><P>
<B><FONT COLOR="#FF0000">Event table macros</FONT></B><P>
To process a menu command event, use these event handler macros to direct input to member
functions that take a wxCommandEvent argument.<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND(id, event, func)</B>
</TD>
<TD VALIGN=TOP>
Process a command, supplying the window identifier,
command event identifier, and member function.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_RANGE(id1, id2, event, func)</B>
</TD>
<TD VALIGN=TOP>
Process a command for a range
of window identifiers, supplying the minimum and maximum window identifiers,
command event identifier, and member function.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_BUTTON(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_BUTTON_CLICKED command,
which is generated by a wxButton control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_CHECKBOX(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_CHECKBOX_CLICKED command,
which is generated by a wxCheckBox control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_CHOICE(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_CHOICE_SELECTED command,
which is generated by a wxChoice control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_LISTBOX(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_LISTBOX_SELECTED command,
which is generated by a wxListBox control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_LISTBOX_DCLICK(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED command,
which is generated by a wxListBox control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TEXT(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TEXT_UPDATED command,
which is generated by a wxTextCtrl control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TEXT_ENTER(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TEXT_ENTER command,
which is generated by a wxTextCtrl control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_MENU(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_MENU_SELECTED command,
which is generated by a menu item.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_MENU_RANGE(id1, id2, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_MENU_RANGE command,
which is generated by a range of menu items.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_SLIDER(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_SLIDER_UPDATED command,
which is generated by a wxSlider control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_RADIOBOX(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_RADIOBOX_SELECTED command,
which is generated by a wxRadioBox control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_RADIOBUTTON(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_RADIOBUTTON_SELECTED command,
which is generated by a wxRadioButton control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_SCROLLBAR(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_SCROLLBAR_UPDATED command,
which is generated by a wxScrollBar control. This is provided for compatibility only;
more specific scrollbar event macros should be used instead (see <A HREF="wx202.htm#wxscrollevent">wxScrollEvent</A>).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMBOBOX(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_COMBOBOX_SELECTED command,
which is generated by a wxComboBox control.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_CLICKED event
(a synonym for wxEVT_COMMAND_MENU_SELECTED). Pass the id of the tool.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_RANGE(id1, id2, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_CLICKED event
for a range id identifiers. Pass the ids of the tools.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_RCLICKED(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_RCLICKED event.
Pass the id of the tool.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_RCLICKED_RANGE(id1, id2, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_RCLICKED event
for a range of ids. Pass the ids of the tools.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TOOL_ENTER(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_TOOL_ENTER event.
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.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_LEFT_CLICK(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_LEFT_CLICK command,
which is generated by a control (Windows 95 and NT only).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_LEFT_DCLICK(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_LEFT_DCLICK command,
which is generated by a control (Windows 95 and NT only).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_RIGHT_CLICK(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_RIGHT_CLICK command,
which is generated by a control (Windows 95 and NT only).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_SET_FOCUS(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_SET_FOCUS command,
which is generated by a control (Windows 95 and NT only).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_KILL_FOCUS(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_KILL_FOCUS command,
which is generated by a control (Windows 95 and NT only).
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_COMMAND_ENTER(id, func)</B>
</TD>
<TD VALIGN=TOP>
Process a wxEVT_COMMAND_ENTER command,
which is generated by a control.
</TD></TR>
</TABLE>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic101">wxCommandEvent::m_clientData</A><BR>
<A HREF="#topic102">wxCommandEvent::m_commandInt</A><BR>
<A HREF="#topic103">wxCommandEvent::m_commandString</A><BR>
<A HREF="#topic104">wxCommandEvent::m_extraLong</A><BR>
<A HREF="#topic105">wxCommandEvent::wxCommandEvent</A><BR>
<A HREF="#topic106">wxCommandEvent::Checked</A><BR>
<A HREF="#topic107">wxCommandEvent::GetClientData</A><BR>
<A HREF="#topic108">wxCommandEvent::GetExtraLong</A><BR>
<A HREF="#topic109">wxCommandEvent::GetInt</A><BR>
<A HREF="#topic110">wxCommandEvent::GetSelection</A><BR>
<A HREF="#topic111">wxCommandEvent::GetString</A><BR>
<A HREF="#topic112">wxCommandEvent::IsSelection</A><BR>
<A HREF="#topic113">wxCommandEvent::SetClientData</A><BR>
<A HREF="#topic114">wxCommandEvent::SetExtraLong</A><BR>
<A HREF="#topic115">wxCommandEvent::SetInt</A><BR>
<A HREF="#topic116">wxCommandEvent::SetString</A><BR>
<P>
<HR>
<A NAME="topic101"></A>
<H3>wxCommandEvent::m_clientData</H3>
<P>
char* m_clientData<P>
Contains a pointer to client data for listboxes and choices, if the event
was a selection.<P>
<HR>
<A NAME="topic102"></A>
<H3>wxCommandEvent::m_commandInt</H3>
<P>
int m_commandInt<P>
Contains an 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.<P>
<HR>
<A NAME="topic103"></A>
<H3>wxCommandEvent::m_commandString</H3>
<P>
char* m_commandString<P>
Contains a string corresponding to a listbox or choice selection.<P>
<HR>
<A NAME="topic104"></A>
<H3>wxCommandEvent::m_extraLong</H3>
<P>
long m_extraLong<P>
Extra information. If the event comes from a listbox selection, it is
a boolean determining whether the event was a selection (TRUE) or a
deselection (FALSE). A listbox deselection only occurs for
multiple-selection boxes, and in this case the index and string values
are indeterminate and the listbox must be examined by the application.<P>
<HR>
<A NAME="topic105"></A>
<H3>wxCommandEvent::wxCommandEvent</H3>
<P>
<B></B> <B>wxCommandEvent</B>(<B>WXTYPE</B><I> commandEventType = 0</I>, <B>int</B><I> id = 0</I>)<P>
Constructor.<P>
<HR>
<A NAME="topic106"></A>
<H3>wxCommandEvent::Checked</H3>
<P>
<B>bool</B> <B>Checked</B>()<P>
Returns TRUE or FALSE for a checkbox selection event.<P>
<HR>
<A NAME="topic107"></A>
<H3>wxCommandEvent::GetClientData</H3>
<P>
<B>char*</B> <B>GetClientData</B>()<P>
Returns client data pointer for a listbox or choice selection event
(not valid for a deselection).<P>
<HR>
<A NAME="topic108"></A>
<H3>wxCommandEvent::GetExtraLong</H3>
<P>
<B>long</B> <B>GetExtraLong</B>()<P>
Returns the <B>m_extraLong</B> member.<P>
<HR>
<A NAME="topic109"></A>
<H3>wxCommandEvent::GetInt</H3>
<P>
<B>int</B> <B>GetInt</B>()<P>
Returns the <B>m_commandInt</B> member.<P>
<HR>
<A NAME="topic110"></A>
<H3>wxCommandEvent::GetSelection</H3>
<P>
<B>int</B> <B>GetSelection</B>()<P>
Returns item index for a listbox or choice selection event (not valid for
a deselection).<P>
<HR>
<A NAME="topic111"></A>
<H3>wxCommandEvent::GetString</H3>
<P>
<B>char*</B> <B>GetString</B>()<P>
Returns item string for a listbox or choice selection event (not valid for
a deselection).<P>
<HR>
<A NAME="topic112"></A>
<H3>wxCommandEvent::IsSelection</H3>
<P>
<B>bool</B> <B>IsSelection</B>()<P>
For a listbox or choice event, returns TRUE if it is a selection, FALSE if it
is a deselection.<P>
<HR>
<A NAME="topic113"></A>
<H3>wxCommandEvent::SetClientData</H3>
<P>
<B>void</B> <B>SetClientData</B>(<B>char*</B><I> clientData</I>)<P>
Sets the client data for this event.<P>
<HR>
<A NAME="topic114"></A>
<H3>wxCommandEvent::SetExtraLong</H3>
<P>
<B>void</B> <B>SetExtraLong</B>(<B>int</B><I> extraLong</I>)<P>
Sets the <B>m_extraLong</B> member.<P>
<HR>
<A NAME="topic115"></A>
<H3>wxCommandEvent::SetInt</H3>
<P>
<B>void</B> <B>SetInt</B>(<B>int</B><I> intCommand</I>)<P>
Sets the <B>m_commandInt</B> member.<P>
<HR>
<A NAME="topic116"></A>
<H3>wxCommandEvent::SetString</H3>
<P>
<B>void</B> <B>SetString</B>(<B>char*</B><I> string</I>)<P>
Sets the <B>m_commandString</B> member.<P>
</BODY></HTML>
|