diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index 690b168605..15b1bb818e 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -101,6 +101,8 @@ protected: int width, int height, int sizeFlags = wxSIZE_AUTO); + virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; // update the height of the drop down list to fit the number of items we diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 5f49fcd97d..e75bef72bd 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -175,6 +175,22 @@ bool wxChoice::Create(wxWindow *parent, style, validator, name); } +bool wxChoice::MSWShouldPreProcessMessage(WXMSG *pMsg) +{ + MSG *msg = (MSG *) pMsg; + + // don't preprocess "ESC" if combobox is dropped down + if ( msg->message == WM_KEYDOWN && msg->wParam == VK_ESCAPE ) + { + if (::SendMessage(GetHwndOf(this), CB_GETDROPPEDSTATE, 0, 0)) + { + return false; + } + } + + return wxControl::MSWShouldPreProcessMessage(pMsg); +} + WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const { // we never have an external border