diff --git a/include/wx/compositewin.h b/include/wx/compositewin.h index a5d93b02bf..32bfcdd9cf 100644 --- a/include/wx/compositewin.h +++ b/include/wx/compositewin.h @@ -218,10 +218,14 @@ private: win = win->GetParent(); } - child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnChar, this); + // Make all keyboard events occurring in sub-windows appear as coming + // from the main window itself. + child->Bind(wxEVT_KEY_DOWN, &wxCompositeWindow::OnKeyEvent, this); + child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnKeyEvent, this); + child->Bind(wxEVT_KEY_UP, &wxCompositeWindow::OnKeyEvent, this); } - void OnChar(wxKeyEvent& event) + void OnKeyEvent(wxKeyEvent& event) { wxEventObjectOriginSetter setThis(event, this, this->GetId()); diff --git a/tests/controls/dataviewctrltest.cpp b/tests/controls/dataviewctrltest.cpp index a22a5aad11..d1c7053af1 100644 --- a/tests/controls/dataviewctrltest.cpp +++ b/tests/controls/dataviewctrltest.cpp @@ -423,7 +423,7 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase, if ( !EnableUITests() ) return; - EventCounter keyEvents(m_dvc->GetMainWindow(), wxEVT_KEY_DOWN); + EventCounter keyEvents(m_dvc, wxEVT_KEY_DOWN); m_dvc->SetFocus();