]> git.saurik.com Git - wxWidgets.git/commitdiff
applied patch #931719: "ESC closes dialog instead of combobox dropdown" (closes patch...
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Fri, 7 May 2004 10:46:19 +0000 (10:46 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Fri, 7 May 2004 10:46:19 +0000 (10:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/choice.h
src/msw/choice.cpp

index 690b16860518e690fb62655b98fbb85f4aa3865b..15b1bb818e4808536873e2b32ae4f05ffb34b2f7 100644 (file)
@@ -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
index 5f49fcd97d6e72cc6b3b4c95e64bd17aa0bc4ee1..e75bef72bdde0d126c399332f11d8780a76dd20f 100644 (file)
@@ -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