Contents Up Previous Next

wxEvtHandler: wxObject

Event handling overview

A class that can handle events from the windowing system. wxWindow (and therefore all window classes) are derived from this class.

wxEvtHandler::nextHandler
wxEvtHandler::previousHandler
wxEvtHandler::wxEvtHandler
wxEvtHandler::~wxEvtHandler
wxEvtHandler::GetClientData
wxEvtHandler::GetNextHandler
wxEvtHandler::GetPreviousHandler
wxEvtHandler::OnActivate
wxEvtHandler::OnChar
wxEvtHandler::OnCharHook
wxEvtHandler::OnCommand
wxEvtHandler::OnClose
wxEvtHandler::OnDefaultAction
wxEvtHandler::OnDropFiles
wxEvtHandler::OnEvent
wxEvtHandler::OnItemEvent
wxEvtHandler::OnItemLeftClick
wxEvtHandler::OnItemMove
wxEvtHandler::OnItemRightClick
wxEvtHandler::OnItemSelect
wxEvtHandler::OnItemSize
wxEvtHandler::OnLeftClick
wxEvtHandler::OnRightClick
wxEvtHandler::OnKillFocus
wxEvtHandler::OnMenuCommand
wxEvtHandler::OnMenuSelect
wxEvtHandler::OnMove
wxEvtHandler::OnPaint
wxEvtHandler::OnScroll
wxEvtHandler::OnSelect
wxEvtHandler::OnSetFocus
wxEvtHandler::OnSize
wxEvtHandler::SetClientData
wxEvtHandler::SetNextHandler
wxEvtHandler::SetPreviousHandler


wxEvtHandler::nextHandler

wxEvtHandler * nextHandler

Protected member variable pointing the next event handler in the chain.


wxEvtHandler::previousHandler

wxEvtHandler * previousHandler

Protected member variable pointing the previous event handler in the chain.


wxEvtHandler::wxEvtHandler

void wxEvtHandler(void)

Constructor.


wxEvtHandler::~wxEvtHandler

void ~wxEvtHandler(void)

Destructor. If the handler is part of a chain, the destructor will unlink itself and restore the previous and next handlers so that they point to each other.


wxEvtHandler::GetClientData

char * GetClientData(void)

Gets user-supplied client data. Normally, any extra data the programmer wishes to associate with the object should be made available by deriving a new class with new data members.


wxEvtHandler::GetNextHandler

wxEvtHandler * GetNextHandler(void)

Gets the pointer to the next handler in the chain.


wxEvtHandler::GetPreviousHandler

wxEvtHandler * GetPreviousHandler(void)

Gets the pointer to the previous handler in the chain.


wxEvtHandler::OnActivate

void OnActivate(Bool active)

Called when a window is activated or deactivated (MS Windows only). If the window is being activated, active is TRUE, else it is FALSE.


wxEvtHandler::OnChar

void OnChar(wxKeyEvent& ch)

Sent to the window when the user has pressed a key. See wxKeyEvent for details.

Note that the ASCII values do not have explicit key codes: they are passed as ASCII values.

See also wxEvtHandler::OnEvent for mouse event notification. OnChar is currently applicable to canvas and panel subwindows only. On some platforms, it may be implemented for text subwindows (not XView).


wxEvtHandler::OnCharHook

Bool OnCharHook(wxKeyEvent& ch)

This member is called (under Windows only) to allow the window to intercept keyboard events before they are processed by child windows. The window receives this event from the default wxApp::OnCharHook member function if the window (frame or dialog box) is active. The function should returns TRUE to indicate the character has been processed, or FALSE to allow default processing. The default implementation for wxWindow returns FALSE, but the wxDialogBox implementation checks for WXK_ESCAPE and tries to close the dialog.

See also wxKeyEvent, wxEvtHandler::OnChar, wxDialogBox::OnCharHook.


wxEvtHandler::OnCommand

void OnCommand(wxWindow &win, wxCommandEvent &event)

This member is called for panel items that do not have a callback function of their own.


wxEvtHandler::OnClose

Sent to the frame when the user has tried to close a managed window (i.e., a frame or dialog box) using the window manager (X) or system menu (Windows). If TRUE is returned by OnClose, the frame will be deleted by the system, otherwise the attempt will be ignored. Derive your own class to handle this message; the default handler returns FALSE.

Bool OnClose(void)


wxEvtHandler::OnDefaultAction

void OnDefaultAction(wxItem *item)

Called when the user initiates the default action for a panel or dialog box, for example by double clicking on a listbox. item is the panel item which caused the default action. See wxPanel::OnDefaultAction.


wxEvtHandler::OnDropFiles

void OnDropFiles(int n, char *files[], int x, int y)

Under Windows, called when files have been dragged from the file manager to the window. files is an array of n strings, and x and y give the mouse position where the drop occurred. The window must have previously been enabled for dropping by calling wxWindow::DragAcceptFiles.


wxEvtHandler::OnEvent

void OnEvent(wxMouseEvent& event)

Sent to the window when the user has initiated an event with the mouse. Derive your own class to handle this message. So far, only relevant to the wxCanvas class. See wxEvtHandler::OnChar for character events, and also wxMouseEvent for how to access event information.


wxEvtHandler::OnItemEvent

void OnItemEvent(wxItem * item, wxMouseEvent & event)

Called in user-interface edit mode when a panel item receives a mouse event. The default implementation manages panel item dragging and sizing.

See wxWindow::SetUserEditMode.


wxEvtHandler::OnItemLeftClick

void OnItemLeftClick(wxItem *item, int x, int y, int keys)

Called in user-interface edit mode when the user left-clicks on a panel item. The coordinates (relative to the item) and a flag indicating shift and control key status are passed. keys is a bit list of wxKEY_SHIFT and wxKEY_CTRL.

See also wxWindow::SetUserEditMode.


wxEvtHandler::OnItemMove

void OnItemMove(wxItem * item, int x, int y)

Called in user-interface edit mode when the item has been moved by the user.

See also wxWindow::SetUserEditMode.


wxEvtHandler::OnItemRightClick

void OnItemRightClick(wxItem *item, int x, int y, int keys)

Called in user-interface edit mode when the user right-clicks on a panel item. The coordinates (relative to the item) and a flag indicating shift and control key status are passed. keys is a bit list of wxKEY_SHIFT and wxKEY_CTRL.

See also wxWindow::SetUserEditMode.


wxEvtHandler::OnItemSelect

void OnItemSelect(wxItem *item, Bool select)

Called when a window is selected or deselected. Currently applies only to panel items in user-interface edit mode.


wxEvtHandler::OnItemSize

void OnItemSize(wxItem * item, int width, int height)

Called in user-interface edit mode when the item has been resized by the user.

See also wxWindow::SetUserEditMode.


wxEvtHandler::OnLeftClick

void OnLeftClick(int x, int y, int keys)

Called in user-interface edit mode when the user left-clicks on the panel background. The coordinates and a flag indicating shift and control key status are passed. keys is a bit list of wxKEY_SHIFT and wxKEY_CTRL.

See also wxWindow::SetUserEditMode.


wxEvtHandler::OnRightClick

void OnRightClick(int x, int y, int keys)

Called in user-interface edit mode when the user right-clicks on the panel background. The coordinates and a flag indicating shift and control key status are passed. keys is a bit list of wxKEY_SHIFT and wxKEY_CTRL.

See also wxWindow::SetUserEditMode.


wxEvtHandler::OnKillFocus

void OnKillFocus(void)

Called when a window's focus is being killed. There are many exceptions to this rule so be careful when relying on it.


wxEvtHandler::OnMenuCommand

void OnMenuCommand(int id)

Sent to a frame window's event handler when an item on the window's menu has been chosen. Derive your own frame class to handle this message. See wxFrame::OnMenuCommand.


wxEvtHandler::OnMenuSelect

void OnMenuSelect(int id)

Sent to a frame's event handler when an item on the frame's menu has been selected (i.e. the cursor is on the item, but the left button has not been released). Derive your own frame class to handle this message. See wxFrame::OnMenuSelect.


wxEvtHandler::OnMove

void OnMove(int x, int y)

Called when a window is moved. Not currently implemented.


wxEvtHandler::OnPaint

void OnPaint(void)

Sent to the event handler when the window must be refreshed. Derive your own class to handle this message. So far, only relevant to the wxCanvas and wxPanel classes.


wxEvtHandler::OnScroll

void OnScroll(wxCommandEvent& event)

Override this function to intercept scroll events. Only implemented for the wxCanvas class. See wxCanvas::OnScroll.


wxEvtHandler::OnSelect

void OnSelect(Bool select)

Called when a window is selected or deselected. Currently applies only to panel items in user-interface edit mode.


wxEvtHandler::OnSetFocus

void OnSetFocus(void)

Called when a window's focus is being set. There are many exceptions to this rule so be careful when relying on it.


wxEvtHandler::OnSize

void OnSize(int x, int y)

Sent to the event handler when the window has been resized. You may wish to use this for frames to resize their child windows as appropriate. Derive your own class to handle this message. Note that the size passed is of the whole window: call GetClientSize for the area which may be used by the application.


wxEvtHandler::SetClientData

void SetClientData(char *data)

Sets user-supplied client data. Normally, any extra data the programmer wishes to associate with the object should be made available by deriving a new class with new data members.


wxEvtHandler::SetNextHandler

void SetNextHandler(wxEvtHandler *handler)

Sets the pointer to the next handler.


wxEvtHandler::SetPreviousHandler

void SetPreviousHandler(wxEvtHandler *handler)

Sets the pointer to the previous handler.