]> git.saurik.com Git - wxWidgets.git/commitdiff
only set maximal tooltip width if it's greater than the previously set one to avoid...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Mar 2009 10:54:56 +0000 (10:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Mar 2009 10:54:56 +0000 (10:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/tooltip.cpp

index 8277cdfb67137eb63b31c944880edca8f1e4d3dd..e92fb061e71d98aca9b33e1579487853447d55b2 100644 (file)
@@ -394,9 +394,16 @@ void wxToolTip::Add(WXHWND hWnd)
             if ( ms_maxWidth != -1 && maxWidth > ms_maxWidth )
                 maxWidth = ms_maxWidth;
 
-            // only set a new width if it is bigger than the current setting
-            SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
-                               wxUIntToPtr(maxWidth));
+            // only set a new width if it is bigger than the current setting:
+            // otherwise adding a tooltip with shorter line(s) than a previous
+            // one would result in breaking the longer lines unnecessarily as
+            // all our tooltips share the same maximal width
+            if ( maxWidth > SendTooltipMessage(GetToolTipCtrl(),
+                                               TTM_GETMAXTIPWIDTH, 0) )
+            {
+                SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
+                                   wxUIntToPtr(maxWidth));
+            }
         }
         else
 #endif // TTM_SETMAXTIPWIDTH