From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Mon, 11 Feb 2008 00:09:24 +0000 (+0000)
Subject: don't use parent window of a TLW in HandleOnNavigationKey(), even if it's apparently... 
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/391b16953a9895de51f2f6ecd9237088903bc0d8

don't use parent window of a TLW in HandleOnNavigationKey(), even if it's apparently harmless it's wrong to involve the parent TLW in the code navigating inside this one

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/src/common/containr.cpp b/src/common/containr.cpp
index d441b5c7c4..c0156165dd 100644
--- a/src/common/containr.cpp
+++ b/src/common/containr.cpp
@@ -316,7 +316,10 @@ wxRadioButton* wxGetSelectedButtonInGroup(wxRadioButton *btn)
 
 void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
 {
-    wxWindow *parent = m_winParent->GetParent();
+    // for a TLW we shouldn't involve the parent window, it has nothing to do
+    // with keyboard navigation inside this TLW
+    wxWindow *parent = m_winParent->IsTopLevel() ? NULL
+                                                 : m_winParent->GetParent();
 
     // the event is propagated downwards if the event emitter was our parent
     bool goingDown = event.GetEventObject() == parent;