CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    M...N
    Posts
    220

    Tooltip in TreeCtrl

    Say there is a TreeCtrl that has many nodes, and would like to display different tooltip for each node in the same control. Is that possible?

    Check the Tooltip in MSDN, it seems only one tip for one control.
    How about one tip for one node in a control?

  2. #2
    Join Date
    Jul 2005
    Posts
    266

    Re: Tooltip in TreeCtrl

    You can setup a different tooltip for different rects using the CToolTip
    BOOL AddTool(
    CWnd* pWnd,
    LPCTSTR lpszText = LPSTR_TEXTCALLBACK,
    LPCRECT lpRectTool = NULL,
    UINT_PTR nIDTool = 0
    );
    lpRectTool can be the rect of the item which you can retrieve using GetItemRect, and nIDTool can be an index. ( make sure index is different for each item and !=0 ). The easiest way is whenever an item is added to your treectrl you use AddTool to add a tooltip to it.

  3. #3
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: Tooltip in TreeCtrl

    It is not necessary to use to use CToolTip. Setting tool dor each node, can end up with considerable number of AddTool calls.

    There is much simpler way of handling it. See my article it may help you.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  4. #4
    Join Date
    Sep 2003
    Location
    M...N
    Posts
    220

    Re: Tooltip in TreeCtrl

    Thanks guys. You both offer very pratical solution to me.
    (Y)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured