Tracking Tooltips!
Hello Everyone,
Yes this is the 3rd time I am posting this since I have no solutions yet, could some please help me with Tracking Tooltips. I tried the example from this link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/usingtooltips.asp.
Thanks in Advance,
Regards,
Ashwin
[358 byte] By [
AshwinRao] at [2007-11-19 9:00:07]

# 1 Re: Tracking Tooltips!
I think, you forgot to mention the problem...
Regards,
Usman.
# 2 Re: Tracking Tooltips!
Hello Usman,
I thougth you would run the attached project to see the problem yourself. Any way the problem is that a blinking rectangle does follow my cursor but shows no text in it.
Regards
Ashwin
# 3 Re: Tracking Tooltips!
Well, its always good to have as much detail as possible & who knows someone might be running lunix and still browsing VC forum ;). Anyways, i have looked at the project attached, i am not sure why you are setting the ToolRect to 0 or null when send TTM_ADDTOOL. The way you should do is to calulate the Rect of the rectangle for which you want to display the ToolTip, and set this calculated Rect when you send TTM_ADDTOOL to the Tooltip. And later on if the rect changes in size or location, use TTM_ADJUSTRECT to let Tooltip know the new rect. To hide ToolTip use TTM_POP and show it again use TTM_ACTIVATE .
With these messages you should be able to do what you want. Let me know if you need any more info.
Regards,
Usman.
# 4 Re: Tracking Tooltips!
Thanks a lot Mr Usman for everyhthing. Ok I now changed the rect cordinates (all) to 100, lets us not not complicate things with TTM_ADJUSTRECT, I still am getting only a blinking rectanganle with no text. What am I doing wrong!!!. Thanks again.
Regards,
Ashwin
# 5 Re: Tracking Tooltips!
Found something else in your code :). Why ru sending message to ToolTip on mousemove?? I suggest to do something like when do TTM_ADDTOOL
instead of TTF_TRACK use TTF_SUBCLASS. And remove the sendMessage TTM_TRACKPOSITION from OnMouseMove.
Hope this helps,
Regards,
Usman.
# 6 Re: Tracking Tooltips!
Hello Mr Usman,
Please dont ask me questions about my code. I have just copied and pasted the snippet from the link in my first post. Any other ideas??.
Regards
Ashwin
# 7 Re: Tracking Tooltips!
Try creating the window like MSDN does...
hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS,
NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
hwnd,
NULL,
ghThisInstance,
NULL
);
Notice the WS_EX_TOPMOST style as the first param. Secondly when you add tool via TTM_ADDTOOL, get the client rect ( like ::GetClientRect(m_hWnd, &ti.rect); )of the whole dialog and set that Rect to ADDTOOL message. Also try removing the TTF_IDISHWND and supply some number like 123 for ... ti.uId = (UINT)123; . Lets see what happens...
Hope this helps,
Regards,
Usman.
# 8 Re: Tracking Tooltips!
Instead of displaying tolltip by your method, you can use already built in component Tooltip control.
I am attaching sample code to display tooltip using tooltip component. It is very easy incorporate.
# 9 Re: Tracking Tooltips!
Prabakaran, AshwinRao was asking for tracking toolbars.
You should not handle tips text in OnNotify override. You do not perform any check for notification code, nor for control that sends notification message. It can cause disaster.
It should be done in TTN_NEEDTEXT(A/W) handler and only if you have LPSTR_TEXTCALLBACK specified as text.
See your modified project.
Also project showing you hw to use native CWnd tooltips and how you can use CToolTipCtrl class; I did not write code to hide tooltips in the last one.
It is shown how it can be done in the others.
JohnCz at 2007-11-11 0:30:05 >

# 10 Re: Tracking Tooltips!
Hello Mr John,
Thanks a lot for providing me a simple solution. I am highly grateful to you.
Regards,
Ashwin
# 11 Re: Tracking Tooltips!
Thank you John.
Actually I misunderstood the problem(as it is not clearly mentioned in the previous thread). Anyway it is really good that problem is solved.