From a7c3dae3a1c37f81b9f7f2ad77d8cf2c3f473ad0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Nov 2002 09:52:51 +0000 Subject: [PATCH] fixed bug in wxToolTip::SetTip() which didn't do anything before git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/tooltip.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index a8a9e5b3f7..7ed9b614e1 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -77,7 +77,7 @@ static WNDPROC gs_wndprocToolTip = (WNDPROC)NULL; class wxToolInfo : public TOOLINFO { public: - wxToolInfo(HWND hwnd) + wxToolInfo(HWND hwndOwner) { // initialize all members ::ZeroMemory(this, sizeof(TOOLINFO)); @@ -95,8 +95,9 @@ public: cbSize = sizeof(TOOLINFO); #endif // compile-time comctl32.dll version + hwnd = hwndOwner; uFlags = TTF_IDISHWND; - uId = (UINT)hwnd; + uId = (UINT)hwndOwner; } }; @@ -311,7 +312,7 @@ void wxToolTip::Add(WXHWND hWnd) } } - HDC hdc = CreateCompatibleDC(NULL); + MemoryHDC hdc; if ( !hdc ) { wxLogLastError(wxT("CreateCompatibleDC(NULL)")); @@ -328,8 +329,6 @@ void wxToolTip::Add(WXHWND hWnd) wxLogLastError(wxT("GetTextExtentPoint")); } - DeleteDC(hdc); - SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH, 0, (void *)sz.cx); } @@ -402,7 +401,7 @@ void wxToolTip::SetTip(const wxString& tip) if ( m_window ) { - // update it immediately + // update the tip text shown by the control wxToolInfo ti(GetHwndOf(m_window)); ti.lpszText = (wxChar *)m_text.c_str();