<wx/event.h>
+\wxheading{Library}
+
+\helpref{wxBase}{librarieslist}
+
\wxheading{See also}
\overview{Event handling overview}{eventhandlingoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
-\membersection{wxEvtHandler::wxEvtHandler}
+\membersection{wxEvtHandler::wxEvtHandler}\label{wxevthandlerctor}
\func{}{wxEvtHandler}{\void}
Constructor.
-\membersection{wxEvtHandler::\destruct{wxEvtHandler}}
+\membersection{wxEvtHandler::\destruct{wxEvtHandler}}\label{wxevthandlerdtor}
\func{}{\destruct{wxEvtHandler}}{\void}
\membersection{wxEvtHandler::AddPendingEvent}\label{wxevthandleraddpendingevent}
-\func{void}{AddPendingEvent}{\param{wxEvent\& }{event}}
+\func{virtual void}{AddPendingEvent}{\param{const wxEvent\& }{event}}
This function posts an event to be processed later.
\membersection{wxEvtHandler::Connect}\label{wxevthandlerconnect}
-\func{void}{Connect}{\param{int}{ id},
+\func{void}{Connect}{\param{int}{ id}, \param{int}{ lastId},
\param{wxEventType }{eventType}, \param{wxObjectEventFunction}{ function},
\param{wxObject*}{ userData = NULL}, \param{wxEvtHandler*}{ eventSink = NULL}}
-\func{void}{Connect}{\param{int}{ id}, \param{int}{ lastId},
+\func{void}{Connect}{\param{int}{ id},
\param{wxEventType }{eventType}, \param{wxObjectEventFunction}{ function},
\param{wxObject*}{ userData = NULL}, \param{wxEvtHandler*}{ eventSink = NULL}}
+\func{void}{Connect}{\param{wxEventType }{eventType}, \param{wxObjectEventFunction}{ function},
+ \param{wxObject*}{ userData = NULL}, \param{wxEvtHandler*}{ eventSink = NULL}}
+
Connects the given function dynamically with the event handler, id and event type. This
-is an alternative to the use of static event tables. See the 'dynamic' sample for usage.
+is an alternative to the use of static event tables. See the 'event' or the old 'dynamic' sample for usage.
\wxheading{Parameters}
-\docparam{id}{The identifier (or first of the identifier range) to be associated with the event handler function.}
+\docparam{id}{The identifier (or first of the identifier range) to be
+associated with the event handler function. For the version not taking this
+argument, it defaults to \texttt{wxID\_ANY}.}
\docparam{lastId}{The second part of the identifier range to be associated with the event handler function.}
\docparam{eventType}{The event type to be associated with this event handler.}
-\docparam{function}{The event handler function.}
+\docparam{function}{The event handler function. Note that this function should
+be explicitly converted to the correct type which can be done using a macro
+called \texttt{wxFooEventHandler} for the handler for any \texttt{wxFooEvent}.}
\docparam{userData}{Data to be associated with the event table entry.}
\docparam{eventSink}{Object whose member function should be called. If this is NULL,
-'this' will be used.}
+\textit{this} will be used.}
\wxheading{Example}
\begin{verbatim}
frame->Connect( wxID_EXIT,
wxEVT_COMMAND_MENU_SELECTED,
- (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) MyFrame::OnQuit );
+ wxCommandEventHandler(MyFrame::OnQuit) );
\end{verbatim}
\perlnote{In wxPerl this function takes 4 arguments: \texttt{id,
\membersection{wxEvtHandler::Disconnect}\label{wxevthandlerdisconnect}
-\func{bool}{Disconnect}{\param{int}{ id},
+\func{bool}{Disconnect}{\param{wxEventType }{eventType = wxEVT\_NULL}, \param{wxObjectEventFunction}{ function = NULL},
+ \param{wxObject*}{ userData = NULL}, \param{wxEvtHandler*}{ eventSink = NULL}}
+
+\func{bool}{Disconnect}{\param{int}{ id = \texttt{wxID\_ANY}},
\param{wxEventType }{eventType = wxEVT\_NULL}, \param{wxObjectEventFunction}{ function = NULL},
\param{wxObject*}{ userData = NULL}, \param{wxEvtHandler*}{ eventSink = NULL}}
-\func{bool}{Disconnect}{\param{int}{ id}, \param{int}{ lastId = -1},
+\func{bool}{Disconnect}{\param{int}{ id}, \param{int}{ lastId = \texttt{wxID\_ANY}},
\param{wxEventType }{eventType = wxEVT\_NULL}, \param{wxObjectEventFunction}{ function = NULL},
\param{wxObject*}{ userData = NULL}, \param{wxEvtHandler*}{ eventSink = NULL}}
\wxheading{Remarks}
-Normally, your application would not call this function: it is called in the wxWindows
+Normally, your application would not call this function: it is called in the wxWidgets
implementation to dispatch incoming user interface events to the framework (and application).
However, you might need to call it if implementing new functionality (such as a new control) where
you define new event types, as opposed to allowing the user to override virtual functions.
An instance where you might actually override the {\bf ProcessEvent} function is where you want
-to direct event processing to event handlers not normally noticed by wxWindows. For example,
+to direct event processing to event handlers not normally noticed by wxWidgets. For example,
in the document/view architecture, documents and views are potential event handlers.
When an event reaches a frame, {\bf ProcessEvent} will need to be called on the associated
document and view in case event handler functions are associated with these objects.
\helpref{wxEvtHandler::SearchEventTable}{wxevthandlersearcheventtable}
+
+\membersection{wxEvtHandler::SafelyProcessEvent}\label{wxevthandlersafelyprocessevent}
+
+\func{bool}{SafelyProcessEvent}{\param{wxEvent\& }{event}}
+
+Processes an event by calling \helpref{ProcessEvent}{wxevthandlerprocessevent}
+and handles any exceptions that occur in the process. If an exception is
+thrown in event handler, \helpref{wxApp::OnExceptionInMainLoop}{wxapponexceptioninmainloop}
+is called.
+
+\wxheading{Parameters}
+
+\docparam{event}{Event to process.}
+
+\wxheading{Return value}
+
+\true if the event was processed, \false if no handler was found or an
+exception was thrown.
+
+\wxheading{See also}
+
+\helpref{wxWindow::HandleWindowEvent}{wxwindowhandlewindowevent}
+
+
\membersection{wxEvtHandler::SearchEventTable}\label{wxevthandlersearcheventtable}
-\func{bool}{SearchEventTable}{\param{wxEventTable\& }{table}, \param{wxEvent\& }{event}}
+\func{virtual bool}{SearchEventTable}{\param{wxEventTable\& }{table}, \param{wxEvent\& }{event}}
Searches the event table, executing an event handler function if an appropriate one
is found.