]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
Don't forbid creating wxSplitterWindow with border style.
[wxWidgets.git] / src / msw / combobox.cpp
index 84b1bca018f7d2a220f8d3f8732dce093cbf0b06..94f6140d50cd9a8221ba13bdbbb503a3ae988cb1 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 
 #include "wx/clipbrd.h"
+#include "wx/dynlib.h"
 #include "wx/wupdlock.h"
 #include "wx/msw/private.h"
 
@@ -300,7 +301,7 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
             // fall through
 
         case WM_SYSCHAR:
-            return HandleChar(wParam, lParam, true /* isASCII */);
+            return HandleChar(wParam, lParam);
 
         case WM_SYSKEYDOWN:
         case WM_KEYDOWN:
@@ -438,6 +439,7 @@ bool wxComboBox::MSWShouldPreProcessMessage(WXMSG *pMsg)
 
 WXHWND wxComboBox::GetEditHWNDIfAvailable() const
 {
+#if wxUSE_DYNLIB_CLASS
 #if defined(WINVER) && WINVER >= 0x0500
     typedef BOOL (WINAPI *GetComboBoxInfo_t)(HWND, COMBOBOXINFO*);
     static GetComboBoxInfo_t s_pfnGetComboBoxInfo = NULL;
@@ -455,7 +457,8 @@ WXHWND wxComboBox::GetEditHWNDIfAvailable() const
         (*s_pfnGetComboBoxInfo)(GetHwnd(), &info);
         return info.hwndItem;
     }
-#endif
+#endif // WINVER >= 0x0500
+#endif // wxUSE_DYNLIB_CLASS
 
     if (HasFlag(wxCB_SIMPLE))
     {
@@ -702,6 +705,22 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
     event.Enable(IsEditable() && !wxTextEntry::IsEmpty());
 }
 
+void wxComboBox::MSWDoPopupOrDismiss(bool show)
+{
+    wxASSERT_MSG( !HasFlag(wxCB_SIMPLE),
+                  wxT("can't popup/dismiss the list for simple combo box") );
+
+    // we *must* set focus to the combobox before showing or hiding the drop
+    // down as without this we get WM_LBUTTONDOWN messages with invalid HWND
+    // when hiding it (whether programmatically or manually) resulting in a
+    // crash when we pass them to IsDialogMessage()
+    //
+    // this can be seen in the combo page of the widgets sample under Windows 7
+    SetFocus();
+
+    ::SendMessage(GetHwnd(), CB_SHOWDROPDOWN, show, 0);
+}
+
 #if wxUSE_TOOLTIPS
 
 void wxComboBox::DoSetToolTip(wxToolTip *tip)