6

How do you add tooltips for CMenu Items? I couldn't find any straightforward and helpful resource. Please help. Thanks...

Owen
  • 4,063
  • 17
  • 58
  • 78

3 Answers3

3

The easiest way is to pass multiple strings to the Menu text separated by newline characters.

This will automagically make CMenu display the second part of the text as the menu tooltip.

e.g., If a menu item text is "Click here", change it to

"Click here\nThis is the tooltip for the menu item ..."

Of course, if you like more advanced/fancy tooltips, then try

http://www.tooltips.net/downloads.html

Its easy to implement, and the output is very cool

Samnan
  • 653
  • 1
  • 5
  • 13
  • 1
    _tooltips.net_ has moved to [vxplib.sourceforge.net](http://vxplib.sourceforge.net/) – mheyman Jul 03 '12 at 16:33
  • My solution is the standard way to add tooltips to menu and toolbars (actually works in VC6) also, so you must be doing something wrong. Check your code for your mainframe class to see if you are not specifically using some styles to disable tooltips – Samnan Nov 26 '14 at 13:30
  • @Samnan A little late, but I just saw your post. I verified this and it does not work for me. The newline character is not recognized and the menu displays as if it wasn't there. `m.AppendMenuW(MF_STRING, IDC_ABC, L"String\nTooltip");` --> Displayed "StringTooltip" – Blacktempel Jul 22 '15 at 08:33
  • @Blacktempel, Visual Studio and MFC have come a long way since I replied :)... I haven't checked with the latest version so you should see MFC samples and one of them must show menus with tooltips.. you can analyze that code and resources in the app to see how its done. I can even guess rich text tooltips might be part of MFC itself now.. – Samnan Jul 24 '15 at 13:24
2

Tooltips for Menu Item and popup menuitem - CodeProject

http://www.codeproject.com/KB/menus/menuitemtooltip.aspx

Tooltips for Menu Items and Popup Menu Items - CodeGuru

http://www.codeguru.com/cpp/controls/controls/tooltipcontrols/article.php/c5233

ratty
  • 13,216
  • 29
  • 75
  • 108
  • I have seen these links before I posted this question. Sadly, the sample itself doesn't work... :( – Owen Mar 08 '10 at 09:39
2

I can't vouch for whether this sample works, but the strategy of handling WM_MENUSELECT is sound:

http://msdn.microsoft.com/en-us/magazine/cc164067.aspx

Dewb
  • 382
  • 1
  • 8