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
This commit is contained in:
Vadim Zeitlin
2002-11-03 09:52:51 +00:00
parent 56e770d6b7
commit a7c3dae3a1

View File

@@ -77,7 +77,7 @@ static WNDPROC gs_wndprocToolTip = (WNDPROC)NULL;
class wxToolInfo : public TOOLINFO class wxToolInfo : public TOOLINFO
{ {
public: public:
wxToolInfo(HWND hwnd) wxToolInfo(HWND hwndOwner)
{ {
// initialize all members // initialize all members
::ZeroMemory(this, sizeof(TOOLINFO)); ::ZeroMemory(this, sizeof(TOOLINFO));
@@ -95,8 +95,9 @@ public:
cbSize = sizeof(TOOLINFO); cbSize = sizeof(TOOLINFO);
#endif // compile-time comctl32.dll version #endif // compile-time comctl32.dll version
hwnd = hwndOwner;
uFlags = TTF_IDISHWND; 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 ) if ( !hdc )
{ {
wxLogLastError(wxT("CreateCompatibleDC(NULL)")); wxLogLastError(wxT("CreateCompatibleDC(NULL)"));
@@ -328,8 +329,6 @@ void wxToolTip::Add(WXHWND hWnd)
wxLogLastError(wxT("GetTextExtentPoint")); wxLogLastError(wxT("GetTextExtentPoint"));
} }
DeleteDC(hdc);
SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH, SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
0, (void *)sz.cx); 0, (void *)sz.cx);
} }
@@ -402,7 +401,7 @@ void wxToolTip::SetTip(const wxString& tip)
if ( m_window ) if ( m_window )
{ {
// update it immediately // update the tip text shown by the control
wxToolInfo ti(GetHwndOf(m_window)); wxToolInfo ti(GetHwndOf(m_window));
ti.lpszText = (wxChar *)m_text.c_str(); ti.lpszText = (wxChar *)m_text.c_str();