diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 9118db73bd..2196918b93 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -2048,6 +2048,7 @@ bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* msg) { switch ( vkey ) { + case 'A': case 'C': case 'V': case 'X': diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index ce33963e3a..99531c5622 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -36,6 +36,7 @@ namespace enum { MenuTestCase_Foo = 10000, + MenuTestCase_SelectAll, MenuTestCase_Bar, MenuTestCase_First }; @@ -168,6 +169,9 @@ void MenuTestCase::CreateFrame() fileMenu->Append(MenuTestCase_Foo, "&Foo\tCtrl-F", "Test item to be found"); m_itemCount++; + fileMenu->Append(MenuTestCase_SelectAll, "Select &all\tCtrl-A", + "Accelerator conflicting with wxTextCtrl"); + m_itemCount++; PopulateMenu(helpMenu, "Helpmenu item ", m_itemCount); @@ -548,6 +552,11 @@ public: return *m_event; } + bool GotEvent() const + { + return m_gotEvent; + } + private: void OnMenu(wxCommandEvent& event) { @@ -607,6 +616,24 @@ void MenuTestCase::Events() wxString(src->GetClassInfo()->GetClassName()) ); CPPUNIT_ASSERT_EQUAL( static_cast(m_menuWithBar), src ); + + // Invoke another accelerator, it should also work. + sim.Char('A', wxMOD_CONTROL); + wxYield(); + + const wxCommandEvent& ev2 = handler.GetEvent(); + CHECK( ev2.GetId() == MenuTestCase_SelectAll ); + + // Now create a text control which uses the same accelerator for itself and + // check that when the text control has focus, the accelerator does _not_ + // work. + wxTextCtrl* const text = new wxTextCtrl(m_frame, wxID_ANY, "Testing"); + text->SetFocus(); + + sim.Char('A', wxMOD_CONTROL); + wxYield(); + + CHECK( !handler.GotEvent() ); #endif // wxUSE_UIACTIONSIMULATOR }