]> git.saurik.com Git - wxWidgets.git/commitdiff
fix the event handling in presence of pushed event handlers broken by r55784 (closes...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Sep 2008 14:11:40 +0000 (14:11 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Sep 2008 14:11:40 +0000 (14:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/doxygen/overviews/eventhandling.h
src/common/event.cpp

index 9618a50ee0eb9569d1be277edc0e45d8b353e64e..80cc860fe1ccb7d46266362d4ed5436693706860 100644 (file)
@@ -332,17 +332,21 @@ doesn't count as having handled the event and the search continues):
 \r
     <li value="5">\r
     The event is passed to the next event handler, if any, in the event handler\r
 \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
     </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
     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
     </li>\r
 \r
     <li value="7">\r
index 6c504bc51ccb95371fb7454aa0dd8364682851f7..d05742d1fd1a438924eeff0c9f712857ff8a017d 100644 (file)
@@ -1273,6 +1273,13 @@ wxEvtHandler::ProcessEventIfMatches(const wxEventTableEntryBase& entry,
 
 bool wxEvtHandler::TryParent(wxEvent& event)
 {
 
 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
     if ( wxTheApp && (this != wxTheApp) )
     {
         // Special case: don't pass wxEVT_IDLE to wxApp, since it'll always