fixed infinite recursion in TAB handling with panels inside panels
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 14 Mar 2000 16:35:03 +0000 (16:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 14 Mar 2000 16:35:03 +0000 (16:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/panelg.cpp

index 2a91143d97638293a2045f0f7321136822d40408..9e8363baa9cc2779427e261c995ec0d709ae544f 100644 (file)
@@ -121,14 +121,20 @@ void wxPanel::OnSize(wxSizeEvent& WXUNUSED(event))
 
 void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
 {
+    // the event is propagated downwards if the event emitter was our parent
+    bool goingDown = event.GetEventObject() == GetParent();
+
     const wxWindowList& children = GetChildren();
 
     // there is not much to do if we don't have children and we're not
     // interested in "notebook page change" events here
     if ( !children.GetCount() || event.IsWindowChange() )
     {
+        // let the parent process it unless it already comes from our parent
+        // of we don't have any
         wxWindow *parent = GetParent();
-        if ( !parent || !parent->GetEventHandler()->ProcessEvent(event) )
+        if ( goingDown ||
+             !parent || !parent->GetEventHandler()->ProcessEvent(event) )
         {
             event.Skip();
         }
@@ -143,9 +149,6 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
     // next acceptable child
     wxWindowList::Node *node, *start_node;
 
-    // the event is propagated downwards if the event emitter was our parent
-    bool goingDown = event.GetEventObject() == GetParent();
-
     // we should start from the first/last control and not from the one which
     // had focus the last time if we're propagating the event downwards because
     // for our parent we look like a single control