|
-
August 23rd, 2004, 02:00 PM
#3
Hi Frank
You're right, it's long ago. I just peeked into my old code and here's what I can tell from a first glance:
- I added an own CToolTipCtrl member variable.
- I handled TTN_NEEDTEXT like this (can't remember why I needed to handle TTN_NEEDTEXTW and why I setup the range 0,0xffff???)
ON_NOTIFY_EX_RANGE (TTN_NEEDTEXTW , 0, 0xffff, OnToolTipNotify)
- I called EnableToolTips(FALSE) in PreSubclassWindow and added the whole client area as a tooltip.
Code:
// disable window object tooltips
EnableToolTips(FALSE);
// add the whole client rect to the member tooltip control
{
CRect rcClient(0,0,0,0);
GetClientRect(rcClient);
ToolTips.AddTool(this,LPSTR_TEXTCALLBACK,&rcClient,1);
ToolTips.EnableToolTips(TRUE);
}
- in OnToolTipNotify, I get the mouse position in client coords and use a little function to get the "Item from point". Then I set the pointer (TOOLTIPTEXTA*)pNMHDR->lpszText to a buffer which holds the tooltip, set pResult=NULL and return FALSE (important!).
Btw. I allocated a buffer for the tooltip and always remember the rectangle of the last hovered column so that I don't have to re-search the item on every mouse movement.
Hope this helps
Oliver
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|