]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/combobox.cpp
new files added
[wxWidgets.git] / src / msw / combobox.cpp
index fafda5dd76996655adddea010c129dfdabb31d64..470a02654cf462dea87c1b646d1ce77d7376305e 100644 (file)
@@ -41,7 +41,7 @@
 #include "wx/msw/private.h"
 
 #if wxUSE_TOOLTIPS
-    #ifndef __GNUWIN32_OLD__
+    #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
         #include <commctrl.h>
     #endif
     #include "wx/tooltip.h"
@@ -115,7 +115,7 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
 #endif // 0
 
         // deal with tooltips here
-#if wxUSE_TOOLTIPS
+#if wxUSE_TOOLTIPS && defined(TTN_NEEDTEXT)
         case WM_NOTIFY:
             {
                 wxCHECK_MSG( win, 0, _T("should have a parent") );
@@ -230,11 +230,24 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 
         case CBN_EDITCHANGE:
             {
+                wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+
                 // if sel != -1, value was initialized above (and we can't use
                 // GetValue() here as it would return the old selection and we
                 // want the new one)
-                wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
-                event.SetString(sel == -1 ? GetValue() : value);
+                if ( sel == -1 )
+                {
+                    value = GetValue();
+                }
+                else // we're synthesizing text updated event from sel change
+                {
+                    // we need to do this because the user code expects
+                    // wxComboBox::GetValue() to return the new value from
+                    // "text updated" handler but it hadn't been updated yet
+                    SetValue(value);
+                }
+
+                event.SetString(value);
                 event.SetEventObject(this);
                 ProcessCommand(event);
             }