]> git.saurik.com Git - wxWidgets.git/commitdiff
Have wxComboCtrl respect parent's wxTAB_TRAVERSAL flag; Also cleaned up key event...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 17 Feb 2009 20:52:16 +0000 (20:52 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 17 Feb 2009 20:52:16 +0000 (20:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/combocmn.cpp

index d2c742df65a09927e3afd822638cbf34ebe1d29d..79c50cedacfaee44b9fb012bd4ca14794e4ba4cc 100644 (file)
@@ -584,14 +584,17 @@ void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event)
 {
     // Let the wxComboCtrl event handler have a go first.
     wxComboCtrlBase* combo = m_combo;
-    wxObject* prevObj = event.GetEventObject();
 
-    event.SetId(combo->GetId());
-    event.SetEventObject(combo);
-    combo->GetEventHandler()->ProcessEvent(event);
+    wxKeyEvent redirectedEvent(event);
+    redirectedEvent.SetId(combo->GetId());
+    redirectedEvent.SetEventObject(combo);
 
-    event.SetId(((wxWindow*)prevObj)->GetId());
-    event.SetEventObject(prevObj);
+    if ( !combo->GetEventHandler()->ProcessEvent(redirectedEvent) )
+    {
+        // Don't let TAB through to the text ctrl - looks ugly
+        if ( event.GetKeyCode() != WXK_TAB )
+            event.Skip();
+    }
 }
 
 void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event)
@@ -1654,7 +1657,8 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event)
     }
     else // no popup
     {
-        if ( HandleAsNavigationKey(event) )
+        if ( GetParent()->HasFlag(wxTAB_TRAVERSAL) &&
+             HandleAsNavigationKey(event) )
             return;
 
         if ( IsKeyPopupToggle(event) )