From 4e916e61ea24c165fb55e78172f1093bf7481b48 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Feb 2009 15:49:10 +0000 Subject: [PATCH] reset the tooltip text before changing it, this apparently prevents a spurious redraw of the control below it (see #10520) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/tooltip.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index f20aa19a35..cf53c69a10 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -546,6 +546,7 @@ wxMSW: - Changed default toolbar bitmaps size from obsolete 16x15 to 24x24 used by modern apps. - Ellipsize long strings in wxStatusBar (Francesco Montorsi) +- Fix spurious repaint when changing tooltip text (Jonathan Liu). wxX11: diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 31ef19fac0..24b7818c97 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -461,8 +461,14 @@ void wxToolTip::SetTip(const wxString& tip) { // update the tip text shown by the control wxToolInfo ti(GetHwndOf(m_window)); - ti.lpszText = (wxChar *)m_text.wx_str(); + // for some reason, changing the tooltip text directly results in + // repaint of the controls under it, see #10520 -- but this doesn't + // happen if we reset it first + ti.lpszText = _T(""); + (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti); + + ti.lpszText = const_cast(m_text.wx_str()); (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti); } } -- 2.47.2