]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/menuitem.cpp
Fix wrong return value from wxWebViewIE::Find() in 64 bit build.
[wxWidgets.git] / src / msw / menuitem.cpp
index 509f021654135228e4a80a19cbff1e859cd63d94..02ea2a9e932036cc3cadb50f40bb056dbb432c70 100644 (file)
@@ -681,15 +681,6 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
     if ( !hMenu || ::GetMenuState(hMenu, id, MF_BYCOMMAND) == (UINT)-1 )
         return;
 
-#if wxUSE_OWNER_DRAWN
-    if ( IsOwnerDrawn() )
-    {
-        // we don't need to do anything for owner drawn items, they will redraw
-        // themselves using the new text the next time they're displayed
-        return;
-    }
-#endif // owner drawn
-
     // update the text of the native menu item
     WinStruct<MENUITEMINFO> info;
 
@@ -712,11 +703,26 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
         return;
     }
 
-    if ( isLaterThanWin95 )
-        info.fMask |= MIIM_STRING;
-    //else: MIIM_TYPE already specified
-    info.dwTypeData = wxMSW_CONV_LPTSTR(m_text);
-    info.cch = m_text.length();
+#if wxUSE_OWNER_DRAWN
+    // Don't set the text for the owner drawn items, they don't use it and even
+    // though setting it doesn't seem to actually do any harm under Windows 7,
+    // avoid doing this relatively nonsensical operation just in case it does
+    // break something on other, past or future, Windows versions.
+    //
+    // Notice that we do need to call SetMenuItemInfo() even for the ownerdrawn
+    // items however as otherwise their size wouldn't be recalculated as
+    // WM_MEASUREITEM wouldn't be sent and this could result in display
+    // problems if the length of the menu item changed significantly.
+    if ( !IsOwnerDrawn() )
+#endif // wxUSE_OWNER_DRAWN
+    {
+        if ( isLaterThanWin95 )
+            info.fMask |= MIIM_STRING;
+        //else: MIIM_TYPE already specified
+        info.dwTypeData = wxMSW_CONV_LPTSTR(m_text);
+        info.cch = m_text.length();
+    }
+
     if ( !::SetMenuItemInfo(hMenu, id, FALSE, &info) )
     {
         wxLogLastError(wxT("SetMenuItemInfo"));