Re: CToolTipCtrl problem in WTL
Karl Edwall <[email protected]> Thu, 9 Aug 2012 10:51:37 +1000
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <CAOt88mMumu=oKKx3dJ3Zg-hToNwB8QsPD1S9YtRjfBCxDw66ow@mail.gmail.com> |
Have you tried setting the delay time, http://msdn.microsoft.com/en-US/library/t7b206dh(v=vs.80) for TTDT_AUTOPOP and see if that works better? Regards, Karl Edwall On Wed, Aug 8, 2012 at 9:23 PM, false <shuaixh-/[email protected]> wrote: > ** > > > i attach a tooltip to a listview, and each time the cursor move to a > listview item , the tooltip will show some corespoding infomation. > the tooltip can really show listview line number indicting which row the > cursor is moving on, but the tooltip won't disappear. > i want the tooltip disappear after 2 second. > > //create: > CToolTipCtrl m_toolTip; //m_toolTip is a member variable in > listview control > > //after listview created, create tooltip > m_toolTip.Create(m_hWnd);//m_hWnd is the listview control > m_toolTip.Activate(TRUE); > > m_toolTip.AddTool(m_hWnd);//m_hWnd is the listview control > m_toolTip.SetMaxTipWidth(260); > > //mouse message > MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) > LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > bHandled) > { > int xPos = GET_X_LPARAM(lParam); > int yPos = GET_Y_LPARAM(lParam); > POINT pt = {xPos, yPos}; > int nItem = HitTest(pt, 0);//which line > if (nItem >= 0) > { > CString s; > s.Format("item %d\nhello world", nItem); > m_toolTip.UpdateTipText(ATL::_U_STRINGorID(s), m_hWnd); > m_toolTip.Activate(TRUE); > } > else > { > m_toolTip.Activate(FALSE); > } > m_toolTip.UpdateTipText("hello", m_hWnd); > > bHandled = FALSE; // Leave the message to next case > return 0; > } > > // > MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST,WM_MOUSELAST, OnMouse) > > LRESULT OnMouse(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) > { > MSG msg = {m_hWnd, uMsg, wParam, lParam }; > if (m_toolTip.IsWindow()) > { > m_toolTip.RelayEvent(&msg); > } > bHandled = FALSE; > return 0; > } > > thanks. > > [Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed] ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wtl/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/wtl/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/