CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    Antwerp, Belgium
    Posts
    136

    Problem : Tooltips in CTreeView



    I'm trying to change the text that appears in the tooltip of treeitems

    in a CTreeView.

    This is the code I wrote in the PreTranslateMessage :

    BOOL CMyTreeView::PreTranslateMessage(MSG* pMsg)

    {

    CToolTipCtrl *pToolTip = GetTreeCtrl().GetToolTips();

    if ( pToolTip )

    {

    CPoint Point(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));

    UINT flag;

    HTREEITEM hItem = GetTreeCtrl().HitTest(Point, &flag);

    if ( hItem != NULL )

    {

    if ( flag & TVHT_ONITEM )

    {

    pToolTip->UpdateTipText("My tooltip", &GetTreeCtrl());

    pToolTip->RelayEvent(pMsg);

    }

    else

    pToolTip->Pop();

    }

    }

    }


    I don't use the TV

    The pToolTip is not null. But the tooltip is never showed.

    What am I doing wrong ?



  2. #2
    Join Date
    Aug 1999
    Location
    Lithuania, Vilnius
    Posts
    35

    Re: Problem : Tooltips in CTreeView

    Hello Franky,

    I just noticed your problem with treeview problem.
    You can solve this problem in this way:

    First of all when creating tree view in Create
    function you must add style TVS_INFOTIP to the tree view. Then you are available to handle TVN_GETINFOTIP notification message. This is
    handler function:

    void CTreeViewToolltipView::OnGetTooltipText(NMHDR* pNMHDR, LRESULT* pResult)
    {
    NMTVGETINFOTIP *lpGetInfoTip = (PNMTVGETINFOTIP)pNMHDR;

    strcpy(lpGetInfoTip -> pszText,
    "My tooltip");

    *pResult = 0;
    }

    in this function you can modify structure lpGetInfoTip.

    Greetings


    ================
    Greetings
    Marius Bakelis
    [email protected]
    =================
    Regards,
    Marius Bakelis

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