Click to See Complete Forum and Search --> : Problem : Tooltips in CTreeView


Franky Braem
March 30th, 1999, 05:48 AM
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 ?

Marius Bakelis
August 24th, 1999, 03:22 AM
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
polynom@taide.lt
=================