AppendixI.Event Classes and Macros

team bbl


Appendix I. Event Classes and Macros

In the wxWidgets reference, the documentation for specific event macros is organized by their event classes (such as wxCommandEvent), which are themselves referenced by the control class documentation (such as wxButton). You can refer to these sections for details, but it's useful to summarize the most commonly used event classes and macros, as shown in Table I-1.

Table I-1. Commonly Used Event Macros

Class: wxActivateEvent

EVT_ACTIVATE(func)

Sent when a user activates or deactivates a top-level window.

EVT_ACTIVATE_APP(func)

Sent when a user activates or deactivates the window of a different application.

Class: wxCommandEvent

EVT_COMMAND(id, event, func)

The same as EVT_CUSTOM, but expects a member function with a wxCommandEvent argument.

EVT_COMMAND_RANGE (id1, id2, event, func)

The same as EVT_CUSTOM_RANGE, but expects a member function with a wxCommandEvent argument.

EVT_BUTTON(id, func)

Processes a wxEVT_COMMAND_BUTTON_CLICKED event, generated when the user left-clicks on a wxButton.

EVT_CHECKBOX(id, func)

Processes a wxEVT_COMMAND_CHECBOX_CLICKED event, generated when the user checks or unchecks a wxCheckBox control.

EVT_CHECKLISTBOX(id, func)

Processes a wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event, generated by a wxCheckListBox control when the user checks or unchecks an item.

EVT_CHOICE(id, func)

Processes a wxEVT_COMMAND_CHOICE_SELECTED event, generated by a wxChoice control when the user selects an item in the list.

EVT_COMBOBOX(id, func)

Processes a wxEVT_COMMAND_COMBOBOX_SELECTED event, generated by a wxComboBox control when the user selects an item in the list.

EVT_LISTBOX(id, func)

Processes a wxEVT_COMMAND_LISTBOX_SELECTED event, generated by a wxListBox control when the user selects an item in the list.

EVT_LISTBOX_DCLICK(id, func)

Processes a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event, generated by a wxListBox control when the user double-clicks on an item in the list.

EVT_TEXT(id, func)

Processes a wxEVT_COMMAND_TEXT_UPDATED event, generated by a wxTextCtrl,wxComboBox, or wxSpinCtrl control when the text is edited.

EVT_TEXT_ENTER(id, func)

Processes a wxEVT_COMMAND_TEXT_ENTER event, generated by a wxTextCtrl control when the user presses the Enter key. Note that you must use wxTE_PROCESS_ENTER style when cre-ating the control if you want it to generate such events.

EVT_TEXT_MAXLEN(id, func)

Processes a wxEVT_COMMAND_TEXT_MAXLEN event, generated by a wxTextCtrl control when the user tries to enter more characters into it than the limit previously set with SetMaxLength. Windows and GTK+ only.

EVT_TOGGLEBUTTON(id, func)

Processes a wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event, generated when the user clicks the button.

EVT_MENU(id, func)

Processes a wxEVT_COMMAND_MENU_SELECTED event, generated by a menu item.

EVT_MENU_RANGE(id1, id2, func)

Processes a wxEVT_COMMAND_MENU_RANGE event, generated by a range of menu items.

EVT_SLIDER(id, func)

Processes a wxEVT_COMMAND_SLIDER_UPDATED event, generated by a wxSlider control when the user moves the slider.

EVT_RADIOBOX(id, func)

Processes a wxEVT_COMMAND_RADIOBOX_SELECTED event, generated by a wxRadioBox control when the user clicks on a radio button

EVT_RADIOBUTTON(id, func)

Processes a wxEVT_COMMAND_RADIOBUTTON_SELECTED event, generated by a wxRadioButton control when a user clicks on it.

EVT_SCROLLBAR(id, func)

Processes a wxEVT_COMMAND_SCROLLBAR_UPDATED event, generated by a wxScrollBar control when any scroll event occurs. For more specific scrollbar event macros, see the documentation for wxScrollEvent.

EVT_TOOL(id, func)

Processes a wxEVT_COMMAND_TOOL_CLICKED event (a synonym for wxEVT_COMMAND_MENU_SELECTED), generated when the user clicks on a toolbar tool. Pass the identifier of the tool.

EVT_TOOL_RANGE(id1, id2, func)

Processes a wxEVT_COMMAND_TOOL_CLICKED event for a range of identifiers. Pass the identifier of the tools.

EVT_TOOL_RCLICKED(id, func)

Processes a wxEVT_COMMAND_TOOL_RCLICKED event, generated when the user right-clicks on a control. Pass the identifier of the tool.

EVT_TOOL_RCLICKED_RANGE (id1, id2, func)

Processes a wxEVT_COMMAND_TOOL_RCLICKED event for a range of identifiers. Pass the identifiers of the tools.

EVT_TOOL_ENTER(id, func)

Processes a wxEVT_COMMAND_TOOL_ENTER event, generated when the mouse pointer moves into or out of a tool. Pass the identifier of the toolbar itself. The value of wxCommand Event::GetSelection is the tool identifier, or -1 if the pointer has moved off a tool.

Class: wxCloseEvent

EVT_CLOSE(func)

Processes a wxEVT_CLOSE_WINDOW event, generated when the user closes a window via the window manager. This event applies to wxFrame and wxDialog classes. The event can be vetoed if CanVeto returns true.

EVT_QUERY_END_SESSION(func)

Processes a wxEVT_QUERY_END_SESSION event, generated when the session is about to end but can be vetoed by the user. This event applies to wxApp only. Windows only.

EVT_END_SESSION(func)

Processes a wxEVT_END_SESSION event, generated when the session is about to end. This event applies to wxApp only. Windows only.

Class: wxContextMenuEvent

EVT_CONTEXT_MENU(id, func)

Processes the event generated when the user has requested a popup menu to appear by pressing a special keyboard key (under Windows) or by right-clicking the mouse.

EVT_COMMAND_CONTEXT_MENU(id, func)

The same as EVT_CONTEXT_MENU, but takes a window identifier.

Class: wxEraseEvent

EVT_ERASE_BACKGROUND(func)

Processes a wxEVT_ERASE_BACKGROUND event, generated when a window's background needs to be repainted.

Class: wxEvent

EVT_CUSTOM(event, id, func)

Allows you to add a custom event table entry by specifying the event identifier (such as wxEVT_SIZE), the window identifier, and a member function to call.

EVT_CUSTOM_RANGE (event, id1, id2, func)

The same as EVT_CUSTOM, but responds to a range of window identifiers.

Class: wxFocusEvent

EVT_SET_FOCUS(func)

Processes a wxEVT_SET_FOCUS event, when a window gains the keyboard focus.

EVT_KILL_FOCUS(func)

Processes a wxEVT_KILL_FOCUS event, when a window loses the keyboard focus.

Class: wxIdleEvent

EVT_IDLE(func)

Handles a wxEVT_IDLE event, passed to Windows and the application object in idle time (when all other events have been processed)

Class: wxInitDialogEvent

EVT_INIT_DIALOG(func)

Handles a wxEVT_INIT_DIALOG event, sent when a dialog is initialized.

Class: wxKeyEvent

EVT_CHAR(func)

Handles a wxEVT_CHAR event, generated when the user presses a key. Provides a translated keycode value

EVT_KEY_DOWN(func)

Handles a wxEVT_KEY_DOWN event, generated when the user presses a key. Provides an untranslated keycode value.

EVT_KEY_UP(func)

Handles a wxEVT_KEY_UP event, generated when a key has been released. Provides an untranslated keycode value.

Class: wxMenuEvent

EVT_MENU_OPEN(func)

Handles a wxEVT_MENU_OPEN event, sent when a menu is about to be opened. On Windows, this is only sent once for each navigation of the menu bar.

EVT_MENU_CLOSE(func)

Handles a wxEVT_MENU_CLOSE event, sent when a menu has just been closed.

EVT_MENU_HIGHLIGHT(id, func)

Handles a wxEVT_MENU_HIGHLIGHT event, sent when the menu item with the specified id has been highlighted. This is used to show help prompts in a frame's status bar.

EVT_MENU_HIGHLIGHT_ALL(func)

Handles a wxEVT_MENU_HIGHLIGHT event for any menu identifier.

Class: wxMouseEvent

EVT_LEFT_DOWN(func)

Handles a wxEVT_LEFT_DOWN event, generated when the left mouse button changes to the "down" state.

EVT_LEFT_UP(func)

Handles a wxEVT_LEFT_UP event, generated when the left mouse button changes to the "up" state.

EVT_LEFT_DCLICK(func)

Handles a wxEVT_LEFT_DCLICK event, generated when the left mouse button is double-clicked.

EVT_MIDDLE_DOWN(func)

Handles a wxEVT_MIDDLE_DOWN event, generated when the middle mouse button changes to the "down" state.

EVT_MIDDLE_UP(func)

Handles a wxEVT_MIDDLE_DCLICK event, generated when the middle mouse button is double-clicked.

EVT_MIDDLE_DCLICK(func)

Handles a wxEVT_MIDDLE_DCLICK event, generated when the middle mouse button is double-clicked.

EVT_RIGHT_DOWN(func)

Handles a wxEVT_RIGHT_DOWN event, generated when the right mouse button changes to the "down" states.

EVT_RIGHT_UP(func)

Handles a wxEVT_RIGHT_UP event, generated when the right mouse button changes to the "up" states.

EVT_RIGHT_DCLICK(func)

Handles a wxEVT_RIGHT_DCLICK event, generated when the right mouse button is double-clicked.

EVT_MOTION(func)

Handles a wxEVT_MOTION event, generated when the mouse moves.

EVT_ENTER_WINDOW(func)

Handles a wxEVT_ENTER_WINDOW event, generated when the mouse enters the window.

EVT_LEAVE_WINDOW(func)

Handles a wxEVT_LEAVE_WINDOW event, generated when the mouse leaves the window.

EVT_MOUSEWHEEL(func)

Handles a wxEVT_MOUSEWHEEL event, generated when the mouse wheel moves.

EVT_MOUSE_EVENTS(func)

Handles all mouse events.

Class: wxMoveEvent

EVT_MOVE(func)

Handles a wxEVT_MOVE event, generated when a window is moved.

Class: wxNotebookEvent

EVT_NOTEBOOK_PAGE_CHANGED(id, func)

The page selection has changed.

EVT_NOTEBOOK_PAGE_CHANGING(id, func)

The selection is about to change. You can veto the selection change with Veto.

Class: wxPaintEvent

EVT_PAINT(func)

Handles a wxEVT_PAINT event, generated when an area of a window needs to be repainted.

Class: wxScrollEvent [1]

EVT_SCROLL(func)

Handles all scroll events.

EVT_SCROLL_TOP(func)

Handles wxEVT_SCROLL_TOP scroll-to-top events (minimum position).

EVT_SCROLL_BOTTOM(func)

Handles wxEVT_SCROLL_TOP scroll-to-bottom events (maximum position).

EVT_SCROLL_LINEUP(func)

Handles wxEVT_SCROLL_LINEUP line up events.

EVT_SCROLL_LINEDOWN(func)

Handles wxEVT_SCROLL_LINEDOWN line down events.

EVT_SCROLL_PAGEUP(func)

Handles wxEVT_SCROLL_PAGEUP page up events.

EVT_SCROLL_PAGEDOWN(func)

Handles wxEVT_SCROLL_PAGEDOWN page down events.

EVT_SCROLL_THUMBTRACK(func)

Handles wxEVT_SCROLL_THUMBTRACK thumb track events (frequent events sent as the user drags the thumbtrack).

EVT_SCROLL_THUMBRELEASE(func)

Handles wxEVT_SCROLL_THUMBRELEASE thumb release events.

EVT_SCROLL_ENDSCROLL(func)

Handles wxEVT_SCROLL_ENDSCROLL end of scrolling events (Windows only).

EVT_COMMAND_SCROLL(id, func)

Handles all scroll events.

EVT_COMMAND_SCROLL_TOP(id, func)

Handles wxEVT_SCROLL_TOP scroll-to-top events (minimum position).

EVT_COMMAND_SCROLL_BOTTOM(id, func)

Handles wxEVT_SCROLL_TOP scroll-to-bottom events (maximum position).

EVT_COMMAND_SCROLL_LINEUP(id, func)

Handles wxEVT_SCROLL_LINEUP line up events.

EVT_COMMAND_SCROLL_LINEDOWN(id, func)

Handles wxEVT_SCROLL_LINEDOWN line down events.

EVT_COMMAND_SCROLL_PAGEUP(id, func)

Handles wxEVT_SCROLL_PAGEUP page up events.

EVT_COMMAND_SCROLL_PAGEDOWN(id, func)

Handles wxEVT_SCROLL_PAGEDOWN page down events.

EVT_COMMAND_SCROLL_THUMBTRACK(id, func)

Handles wxEVT_SCROLL_THUMBTRACK thumb track events (frequent events sent as the user drags the thumbtrack).

EVT_COMMAND_SCROLL_THUMBRELEASE(id, func)

Handles wxEVT_SCROLL_THUMBRELEASE thumb release events.

EVT_COMMAND_SCROLL_ENDSCROLL(id, func)

Handles wxEVT_SCROLL_ENDSCROLL end of scrolling events (Windows only).

Class: wxScrollWinEvent [2]

EVT_SCROLLWIN(func)

Handles all scroll events.

EVT_SCROLLWIN_TOP(func)

Handles wxEVT_SCROLLWIN_TOP scroll-to-top events.

EVT_SCROLLWIN_BOTTOM(func)

Handles wxEVT_SCROLLWIN_TOP scroll-to-bottom events.

EVT_SCROLLWIN_LINEUP(func)

Handles wxEVT_SCROLLWIN_LINEUP line up events.

EVT_SCROLLWIN_LINEDOWN(func)

Handles wxEVT_SCROLLWIN_LINEDOWN line down events.

EVT_SCROLLWIN_PAGEUP(func)

Handles wxEVT_SCROLLWIN_PAGEUP page up events.

EVT_SCROLLWIN_PAGEDOWN(func)

Handles wxEVT_SCROLLWIN_PAGEDOWN page down events.

EVT_SCROLLWIN_THUMBTRACK(func)

Handles wxEVT_SCROLLWIN_THUMBTRACK thumbtrack events (frequent events sent as the user drags the thumbtrack).

EVT_SCROLLWIN_THUMBRELEASE(func)

Handles wxEVT_SCROLLWIN_THUMBRELEASE thumb release events.

Class: wxSizeEvent

EVT_SIZE(func)

Handles a wxEVT_SIZE event, generated when the window is resized

Class: wxSpinEvent

EVT_SPIN(id, func)

Handles a wxEVT_SCROLL_THUMBTRACK event, generated for a wxSpinButton or wxSpinCtrl whenever the up or down arrows are clicked.

EVT_SPIN_UP(id, func)

Handles a wxEVT_SCROLL_LINEUP event, generated for a wxSpinButton or wxSpinCtrl when the up arrow is clicked.

EVT_SPIN_DOWN(id, func)

Handles a wxEVT_SCROLL_LINEDOWN event, generated for a wxSpinButton or wxSpinCtrl when the down arrow is clicked.

EVT_SPINCTRL(id, func)

Handles all events generated for a wxSpinCtrl.

Class: wxSplitterEvent

EVT_SPLITTER_SASH_POS_CHANGING(id, func)

Processes a wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING event, generated when the sash position is in the process of being changed.

EVT_SPLITTER_SASH_POS_CHANGED(id, func)

Processes a wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED event, generated when the sash position is changed. May be used to modify the sash position before it is set, or to prevent the change from taking place.

EVT_SPLITTER_UNSPLIT(id, func)

Processes a wxEVT_COMMAND_SPLITTER_UNSPLIT event, generated when the splitter is unsplit

EVT_SPLITTER_DCLICK(id, func)

Processes a wxEVT_COMMAND_SPLITTER_DOUBLECLICKED event, generated when the sash is double-clicked.

Class: wxSysColourChangeEvent

EVT_SYS_COLOUR_CHANGED event, (func)

Processes a wxEVT_SYS_COLOUR_CHANGED generated when the user changed a color in the control panel (Windows only).

Class: wxUpdateUIEvent

EVT_UPDATE_UI(id, func)

The EVT_UPDATE_UI macro is used to handle user interface update pseudo-events, which are generated to give the application the chance to update the visual state of menus, toolbars, and controls (see Chapter 9, "Creating Custom Dialogs"). Processes a wxEVT_UPDATE_UI event.

EVT_UPDATE_UI_RANGE (id1, id2, func)

Processes a wxEVT_UPDATE_UI event for a range of identifiers.

Class: wxWindowCreateEvent

EVT_WINDOW_CREATE(func)

Processes a wxEVT_CREATE propagating event, generated when the underlying window has just been created.

Class: wxWindowDestroyEvent

EVT_WINDOW_DESTROY(func)

Processes a wxEVT_DELETE propagating event, generated when the window is about to be destroyed.

EVT_MIDDLE_DCLICK(func)

Handles a wxEVT_MIDDLE_DCLICK event, generated when the middle mouse button is double-clicked.

EVT_RIGHT_DOWN(func)

Handles a wxEVT_RIGHT_DOWN event, generated when the right mouse button changes to the "down" states

EVT_RIGHT_UP(func)

Handles a wxEVT_RIGHT_UP event, generated when the right mouse button changes to the "up" states.


[1] These macros are used to handle scroll events from wxScrollBar, wxSlider, and wxSpinButton. See wxScrollWinEvent for wxScrolledWindow events.

[2] These macros are used to handle scroll events from scrolling windows. See also wxScrollEvent earlier.

    team bbl



    Cross-Platform GUI Programming with wxWidgets
    Cross-Platform GUI Programming with wxWidgets
    ISBN: 0131473816
    EAN: 2147483647
    Year: 2005
    Pages: 262

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net