1 \section{\class{wxEvtHandler
}}\label{wxevthandler
}
3 A class that can handle events from the windowing system.
4 wxWindow (and therefore all window classes) are derived from
7 \wxheading{Derived from
}
9 \helpref{wxObject
}{wxobject
}
13 \overview{Event handling overview
}{eventhandlingoverview
}
15 \latexignore{\rtfignore{\wxheading{Members
}}}
17 \membersection{wxEvtHandler::wxEvtHandler
}
19 \func{}{wxEvtHandler
}{\void}
23 \membersection{wxEvtHandler::
\destruct{wxEvtHandler
}}
25 \func{}{\destruct{wxEvtHandler
}}{\void}
27 Destructor. If the handler is part of a chain, the destructor will
28 unlink itself and restore the previous and next handlers so that they point to
31 \membersection{wxEvtHandler::Default
}\label{wxevthandlerdefault
}
33 \func{virtual long
}{Default
}{\void}
35 Invokes default processing if this event handler is a window.
37 \wxheading{Return value
}
43 A generic way of delegating processing to the default system behaviour. It calls a platform-dependent
44 default function, with parameters dependent on the event or message parameters
45 originally sent from the windowing system.
47 Normally the application should call a base member, such as
\helpref{wxWindow::OnChar
}{wxwindowonchar
}, which itself
48 may call
{\bf Default
}.
50 \membersection{wxEvtHandler::GetClientData
}\label{wxevthandlergetclientdata
}
52 \func{char*
}{GetClientData
}{\void}
54 Gets user-supplied client data.
58 Normally, any extra data the programmer wishes to associate with the object
59 should be made available by deriving a new class
60 with new data members.
64 \helpref{wxEvtHandler::SetClientData
}{wxevthandlersetclientdata
}
66 \membersection{wxEvtHandler::GetEvtHandlerEnabled
}\label{wxevthandlergetevthandlerenabled
}
68 \func{bool
}{GetEvtHandlerEnabled
}{\void}
70 Returns TRUE if the event handler is enabled, FALSE otherwise.
74 \helpref{wxEvtHandler::SetEvtHandlerEnabled
}{wxevthandlersetevthandlerenabled
}
76 \membersection{wxEvtHandler::GetNextHandler
}\label{wxevthandlergetnexthandler
}
78 \func{wxEvtHandler*
}{GetNextHandler
}{\void}
80 Gets the pointer to the next handler in the chain.
84 \helpref{wxEvtHandler::GetPreviousHandler
}{wxevthandlergetprevioushandler
},
\rtfsp
85 \helpref{wxEvtHandler::SetPreviousHandler
}{wxevthandlersetprevioushandler
},
\rtfsp
86 \helpref{wxEvtHandler::SetNextHandler
}{wxevthandlersetnexthandler
},
\rtfsp
87 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
88 \helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
}
90 \membersection{wxEvtHandler::GetPreviousHandler
}\label{wxevthandlergetprevioushandler
}
92 \func{wxEvtHandler*
}{GetPreviousHandler
}{\void}
94 Gets the pointer to the previous handler in the chain.
98 \helpref{wxEvtHandler::GetPreviousHandler
}{wxevthandlergetprevioushandler
},
\rtfsp
99 \helpref{wxEvtHandler::SetPreviousHandler
}{wxevthandlersetprevioushandler
},
\rtfsp
100 \helpref{wxEvtHandler::SetPreviousHandler
}{wxevthandlersetprevioushandler
},
\rtfsp
101 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
102 \helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
}
104 \membersection{wxEvtHandler::ProcessEvent
}\label{wxevthandlerprocessevent
}
106 \func{virtual bool
}{ProcessEvent
}{\param{wxEvent\&
}{event
}}
108 Processes an event, searching event tables and calling zero or more suitable event handler function(s).
110 \wxheading{Parameters
}
112 \docparam{event
}{Event to process.
}
114 \wxheading{Return value
}
116 TRUE if a suitable event handler function was found and executed, and the function did not
117 call
\helpref{wxEvent::Skip
}{wxeventskip
}.
121 Normally, your application would not call this function: it is called in the wxWindows
122 implementation to dispatch incoming user interface events to the framework (and application).
124 However, you might need to call it if implementing new functionality (such as a new control) where
125 you define new event types, as opposed to allowing the user to override virtual functions.
127 An instance where you might actually override the
{\bf ProcessEvent
} function is where you want
128 to direct event processing to event handlers not normally noticed by wxWindows. For example,
129 in the
document/view architecture, documents and views are potential event handlers.
130 When an event reaches a frame,
{\bf ProcessEvent
} will need to be called on the associated
131 document and view in case event handler functions are associated with these objects.
132 The property classes library (wxProperty) also overrides
{\bf ProcessEvent
} for similar reasons.
134 The normal order of event table searching is as follows:
136 \begin{enumerate
}\itemsep=
0pt
137 \item If the object is disabled (via a call to
\helpref{wxEvtHandler::SetEvtHandlerEnabled
}{wxevthandlersetevthandlerenabled
})
138 the function skips to step (
6).
139 \item If the object is a wxWindow,
{\bf ProcessEvent
} is recursively called on the window's
\rtfsp
140 \helpref{wxValidator
}{wxvalidator
}. If this returns TRUE, the function exits.
141 \item {\bf SearchEventTable
} is called for this event handler. If this fails, the base
142 class table is tried, and so on until no more tables exist or an appropriate function was found,
143 in which case the function exits.
144 \item The search is applied down the entire chain of event handlers (usually the chain has a length
145 of one). If this succeeds, the function exits.
146 \item If the object is a wxWindow and the event is a wxCommandEvent,
{\bf ProcessEvent
} is
147 recursively applied to the parent window's event handler. If this returns TRUE, the function exits.
148 \item Finally,
{\bf ProcessEvent
} is called on the wxApp object.
153 \helpref{wxEvtHandler::SearchEventTable
}{wxevthandlersearcheventtable
}
155 \membersection{wxEvtHandler::SearchEventTable
}\label{wxevthandlersearcheventtable
}
157 \func{bool
}{SearchEventTable
}{\param{wxEventTable\&
}{table
},
\param{wxEvent\&
}{event
}}
159 Searches the event table, executing an event handler function if an appropriate one
162 \wxheading{Parameters
}
164 \docparam{table
}{Event table to be searched.
}
166 \docparam{event
}{Event to be matched against an event table entry.
}
168 \wxheading{Return value
}
170 TRUE if a suitable event handler function was found and executed, and the function did not
171 call
\helpref{wxEvent::Skip
}{wxeventskip
}.
175 This function looks through the object's event table and tries to find an entry
176 that will match the event.
178 An entry will match if:
180 \begin{enumerate
}\itemsep=
0pt
181 \item The event type matches, and
182 \item the identifier or identifier range matches, or the event table entry's identifier is zero.
185 If a suitable function is called but calls
\helpref{wxEvent::Skip
}{wxeventskip
}, this function will
186 fail, and searching will continue.
190 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
}
192 \membersection{wxEvtHandler::SetClientData
}\label{wxevthandlersetclientdata
}
194 \func{void
}{SetClientData
}{\param{char*
}{data
}}
196 Sets user-supplied client data.
198 \wxheading{Parameters
}
200 \docparam{data
}{Data to be associated with the event handler.
}
204 Normally, any extra data the programmer wishes
205 to associate with the object should be made available by deriving a new class
206 with new data members.
208 TODO: make this void*, char* only in compatibility mode.
212 \helpref{wxEvtHandler::GetClientData
}{wxevthandlergetclientdata
}
214 \membersection{wxEvtHandler::SetEvtHandlerEnabled
}\label{wxevthandlersetevthandlerenabled
}
216 \func{void
}{SetEvtHandlerEnabled
}{\param{bool
}{enabled
}}
218 Enables or disables the event handler.
220 \wxheading{Parameters
}
222 \docparam{enabled
}{TRUE if the event handler is to be enabled, FALSE if it is to be disabled.
}
226 You can use this function to avoid having to remove the event handler from the chain, for example
227 when implementing a dialog editor and changing from edit to test mode.
231 \helpref{wxEvtHandler::GetEvtHandlerEnabled
}{wxevthandlergetevthandlerenabled
}
233 \membersection{wxEvtHandler::SetNextHandler
}\label{wxevthandlersetnexthandler
}
235 \func{void
}{SetNextHandler
}{\param{wxEvtHandler*
}{handler
}}
237 Sets the pointer to the next handler.
239 \wxheading{Parameters
}
241 \docparam{handler
}{Event handler to be set as the next handler.
}
245 \helpref{wxEvtHandler::GetNextHandler
}{wxevthandlergetnexthandler
},
\rtfsp
246 \helpref{wxEvtHandler::SetPreviousHandler
}{wxevthandlersetprevioushandler
},
\rtfsp
247 \helpref{wxEvtHandler::GetPreviousHandler
}{wxevthandlergetprevioushandler
},
\rtfsp
248 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
249 \helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
}
251 \membersection{wxEvtHandler::SetPreviousHandler
}\label{wxevthandlersetprevioushandler
}
253 \func{void
}{SetPreviousHandler
}{\param{wxEvtHandler*
}{handler
}}
255 Sets the pointer to the previous handler.
257 \wxheading{Parameters
}
259 \docparam{handler
}{Event handler to be set as the previous handler.
}
263 \helpref{wxEvtHandler::GetPreviousHandler
}{wxevthandlergetprevioushandler
},
\rtfsp
264 \helpref{wxEvtHandler::SetNextHandler
}{wxevthandlersetnexthandler
},
\rtfsp
265 \helpref{wxEvtHandler::GetNextHandler
}{wxevthandlergetnexthandler
},
\rtfsp
266 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
267 \helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
}