\r
<li value="5">\r
The event is passed to the next event handler, if any, in the event handler\r
- chain. This chain can be formed using wxEvtHandler::SetNextHandler() or\r
- wxWindow::PushEventHandler() but usually there is no next event handler and\r
- chaining event handlers using these functions is much less useful now that\r
- Connect() exists so this step will almost never do anything.\r
+ chain, i.e. the steps (1) to (4) are done for it. This chain can be formed\r
+ using wxEvtHandler::SetNextHandler() or wxWindow::PushEventHandler() but\r
+ usually there is no next event handler and chaining event handlers using\r
+ these functions is much less useful now that Connect() exists so this step\r
+ will almost never do anything.\r
</li>\r
\r
<li value="6">\r
- If the object is a wxWindow and the event is set to set to propagate (by\r
- default only wxCommandEvent-derived events are set to propagate), then the\r
+ If the object is a wxWindow and the event is set to propagate (by default\r
+ only wxCommandEvent-derived events are set to propagate), then the\r
processing restarts from the step (1) (and excluding the step (7)) for the\r
- parent window.\r
+ parent window. If this object is not a window but the next handler exists,\r
+ the event is passed to its parent if it is a window. This ensures that in a\r
+ common case of (possibly several) non-window event handlers pushed on top\r
+ of a window, the event eventually reaches the window parent.\r
</li>\r
\r
<li value="7">\r
bool wxEvtHandler::TryParent(wxEvent& event)
{
+ if ( GetNextHandler() )
+ {
+ // the next handler will pass it to wxTheApp if it doesn't process it,
+ // so return from here to avoid doing it again
+ return GetNextHandler()->TryParent(event);
+ }
+
if ( wxTheApp && (this != wxTheApp) )
{
// Special case: don't pass wxEVT_IDLE to wxApp, since it'll always