From: Vadim Zeitlin Date: Fri, 6 Mar 2009 10:54:56 +0000 (+0000) Subject: only set maximal tooltip width if it's greater than the previously set one to avoid... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d90ef8e4c243a66548765fa1e502dbb55589d723 only set maximal tooltip width if it's greater than the previously set one to avoid breaking long lines if a shorter tooltip is added afterwards (see #10537) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 8277cdfb67..e92fb061e7 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -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