evthand.tex

来自「Wxpython Implemented on Windows CE, Sou」· TEX 代码 · 共 399 行 · 第 1/2 页

TEX
399
字号

\helpref{wxEvtHandler::SetNextHandler}{wxevthandlersetnexthandler},\rtfsp
\helpref{wxEvtHandler::GetPreviousHandler}{wxevthandlergetprevioushandler},\rtfsp
\helpref{wxEvtHandler::SetPreviousHandler}{wxevthandlersetprevioushandler},\rtfsp
\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
\helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler}

\membersection{wxEvtHandler::GetPreviousHandler}\label{wxevthandlergetprevioushandler}

\func{wxEvtHandler*}{GetPreviousHandler}{\void}

Gets the pointer to the previous handler in the chain.

\wxheading{See also}

\helpref{wxEvtHandler::SetPreviousHandler}{wxevthandlersetprevioushandler},\rtfsp
\helpref{wxEvtHandler::GetNextHandler}{wxevthandlergetnexthandler},\rtfsp
\helpref{wxEvtHandler::SetNextHandler}{wxevthandlersetnexthandler},\rtfsp
\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
\helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler}

\membersection{wxEvtHandler::ProcessEvent}\label{wxevthandlerprocessevent}

\func{virtual bool}{ProcessEvent}{\param{wxEvent\& }{event}}

Processes an event, searching event tables and calling zero or more suitable event handler function(s).

\wxheading{Parameters}

\docparam{event}{Event to process.}

\wxheading{Return value}

true if a suitable event handler function was found and executed, and the function did not
call \helpref{wxEvent::Skip}{wxeventskip}.

\wxheading{Remarks}

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 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.
The property classes library (wxProperty) also overrides {\bf ProcessEvent} for similar reasons.

The normal order of event table searching is as follows:

\begin{enumerate}\itemsep=0pt
\item If the object is disabled (via a call to \helpref{wxEvtHandler::SetEvtHandlerEnabled}{wxevthandlersetevthandlerenabled})
the function skips to step (6).
\item If the object is a wxWindow, {\bf ProcessEvent} is recursively called on the window's\rtfsp
\helpref{wxValidator}{wxvalidator}. If this returns true, the function exits.
\item {\bf SearchEventTable} is called for this event handler. If this fails, the base
class table is tried, and so on until no more tables exist or an appropriate function was found,
in which case the function exits.
\item The search is applied down the entire chain of event handlers (usually the chain has a length
of one). If this succeeds, the function exits.
\item If the object is a wxWindow and the event is a wxCommandEvent, {\bf ProcessEvent} is
recursively applied to the parent window's event handler. If this returns true, the function exits.
\item Finally, {\bf ProcessEvent} is called on the wxApp object.
\end{enumerate}

\wxheading{See also}

\helpref{wxEvtHandler::SearchEventTable}{wxevthandlersearcheventtable}

\membersection{wxEvtHandler::SearchEventTable}\label{wxevthandlersearcheventtable}

\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.

\wxheading{Parameters}

\docparam{table}{Event table to be searched.}

\docparam{event}{Event to be matched against an event table entry.}

\wxheading{Return value}

true if a suitable event handler function was found and executed, and the function did not
call \helpref{wxEvent::Skip}{wxeventskip}.

\wxheading{Remarks}

This function looks through the object's event table and tries to find an entry
that will match the event.

An entry will match if:

\begin{enumerate}\itemsep=0pt
\item The event type matches, and
\item the identifier or identifier range matches, or the event table entry's identifier is zero.
\end{enumerate}

If a suitable function is called but calls \helpref{wxEvent::Skip}{wxeventskip}, this function will
fail, and searching will continue.

\wxheading{See also}

\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent}

\membersection{wxEvtHandler::SetClientData}\label{wxevthandlersetclientdata}

\func{void}{SetClientData}{\param{void* }{data}}

Sets user-supplied client data.

\wxheading{Parameters}

\docparam{data}{Data to be associated with the event handler.}

\wxheading{Remarks}

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. You must not call this method and
\helpref{SetClientObject}{wxevthandlersetclientobject} on the
same class - only one of them.

\wxheading{See also}

\helpref{wxEvtHandler::GetClientData}{wxevthandlergetclientdata}

\membersection{wxEvtHandler::SetClientObject}\label{wxevthandlersetclientobject}

\func{void}{SetClientObject}{\param{wxClientData* }{data}}

Set the client data object. Any previous object will be deleted.

\wxheading{See also}

\helpref{wxEvtHandler::GetClientObject}{wxevthandlergetclientobject},
\helpref{wxClientData}{wxclientdata}

\membersection{wxEvtHandler::SetEvtHandlerEnabled}\label{wxevthandlersetevthandlerenabled}

\func{void}{SetEvtHandlerEnabled}{\param{bool }{enabled}}

Enables or disables the event handler.

\wxheading{Parameters}

\docparam{enabled}{true if the event handler is to be enabled, false if it is to be disabled.}

\wxheading{Remarks}

You can use this function to avoid having to remove the event handler from the chain, for example
when implementing a dialog editor and changing from edit to test mode.

\wxheading{See also}

\helpref{wxEvtHandler::GetEvtHandlerEnabled}{wxevthandlergetevthandlerenabled}

\membersection{wxEvtHandler::SetNextHandler}\label{wxevthandlersetnexthandler}

\func{void}{SetNextHandler}{\param{wxEvtHandler* }{handler}}

Sets the pointer to the next handler.

\wxheading{Parameters}

\docparam{handler}{Event handler to be set as the next handler.}

\wxheading{See also}

\helpref{wxEvtHandler::GetNextHandler}{wxevthandlergetnexthandler},\rtfsp
\helpref{wxEvtHandler::SetPreviousHandler}{wxevthandlersetprevioushandler},\rtfsp
\helpref{wxEvtHandler::GetPreviousHandler}{wxevthandlergetprevioushandler},\rtfsp
\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
\helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler}

\membersection{wxEvtHandler::SetPreviousHandler}\label{wxevthandlersetprevioushandler}

\func{void}{SetPreviousHandler}{\param{wxEvtHandler* }{handler}}

Sets the pointer to the previous handler.

\wxheading{Parameters}

\docparam{handler}{Event handler to be set as the previous handler.}

\wxheading{See also}

\helpref{wxEvtHandler::GetPreviousHandler}{wxevthandlergetprevioushandler},\rtfsp
\helpref{wxEvtHandler::SetNextHandler}{wxevthandlersetnexthandler},\rtfsp
\helpref{wxEvtHandler::GetNextHandler}{wxevthandlergetnexthandler},\rtfsp
\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
\helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?