From 4b17d2e361e22202f7c1be6e0babcc261261d686 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Fri, 7 May 2004 10:46:19 +0000 Subject: [PATCH] applied patch #931719: "ESC closes dialog instead of combobox dropdown" (closes patch #931709) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/choice.h | 2 ++ src/msw/choice.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) 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 -- 2.45.2