Click here to Skip to main content
Click here to Skip to main content

Tooltips for Menu Item and popup menuitem

, 19 Nov 2003
Rate this:
Please Sign up or sign in to vote.
Simple and best way to add tooltips to the menu items. All you have to do is simply include the header file and call Create and hook the WM_MENUSELECT message.

Sample Image - menuitemtooltip.gif

Introduction

This article describes what is in my opinion the simplest and best way to add tool tips to the menu items. All you have to do is simply include the header file and call Create and hook the WM_MENUSELECT message.

Call this Create function in OnInitDialog or OnCreate functions of your main window

myMenuToolTip.Create(m_hWnd, _T("Sample Menu Text"), 
    AfxGetResourceHandle(), TTS_NOPREFIX | TTS_BALLOON 
         // play with this flags to get your own style of toolips
, _T("My Best Tool Tip Title") // title for the tooltips
);

When your window receives WM_MENUSELECT, call OnMenuSelect function to notify my helper class

myMenuToolTip.OnMenuSelect(nItemID, nFlags, hSubMenu);

Helper Class implementation

  1. Creates a tool tip window and adds the parent as tool to tooltip window
  2. Makes the tool as trackable tool
  3. On MenuSelect (Highlight) based on selected item, helper class activates the tooltip and positions it next selected menu item.
  4. On MenuSelect (Unhighlight) deactivates the tooltip

Instead of just calling OnMenuSelect you could handle the menu messages by looking at default implementation in the helper class

Note: Tip text is extracted from resource just like MFC/WTL extracts text for status bar messages.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

venu8000

United States United States
No Biography provided

Comments and Discussions

 
GeneralTooltips for Menu Item not working PinmemberDarryl Bryk9-Feb-10 13:23 
GeneralRe: Tooltips for Menu Item not working Pinmemberseav7314-Aug-12 4:28 
GeneralRe: Tooltips for Menu Item not working PinmemberDarryl Bryk28-Aug-12 10:37 
QuestionHas anybody got popup menu item tooltips working? PinmemberDave Streeter25-Aug-09 22:45 
AnswerRe: Has anybody got popup menu item tooltips working? PinmemberDarryl Bryk27-Apr-10 13:12 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberAndrew Phillips8-Jul-10 17:42 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberAndrew Phillips8-Jul-10 18:45 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberDarryl Bryk9-Jul-10 8:59 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberAndrew Phillips12-Jul-10 8:52 
QuestionRe: Has anybody got popup menu item tooltips working? PinmemberDarryl Bryk9-Jul-10 9:20 
AnswerRe: Has anybody got popup menu item tooltips working? PinmemberAndrew Phillips12-Jul-10 9:08 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberDarryl Bryk19-Jul-10 9:07 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberAndrew Phillips26-Jul-10 12:07 
GeneralRe: Has anybody got popup menu item tooltips working? PinmemberDarryl Bryk2-Aug-10 6:13 
AnswerRe: Has anybody got popup menu item tooltips working? Pinmembernbnacario12-Mar-14 7:36 
GeneralProblem in VC7 Pinmembersandip.lad30-Jul-09 19:10 
GeneralI built it with VS2005, when it runs, no tooltips displayed PinmemberBruce Li7-Mar-08 4:38 
Generalhelp i cant get it to work Pinmemberyotamwimmer18-Jul-07 16:26 
Generalfailure when use XP themes! Pinmembermaiquan19878-Apr-05 23:23 
GeneralRe: failure when use XP themes! PinmemberAnil K P5-Jul-07 19:33 
GeneralTips can display off screen PinmemberR.D.H.19-Jan-05 5:20 
GeneralIncorrect show for second, third etc. submenu PinmemberEugene Pustovoyt16-Dec-03 3:03 
GeneralRe: Incorrect show for second, third etc. submenu Pinmembervenu800016-Dec-03 6:00 
GeneralCan't work for dynamic menu Pinmemberdaveice10-Dec-03 21:32 
GeneralNot bad! PinmemberWREY24-Nov-03 22:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 20 Nov 2003
Article Copyright 2003 by venu8000
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid