<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Dynamic Tooltips for MenuItems</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Visual C++ MFC : Dynamic Tooltips for MenuItems]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 09 Apr 2026 22:00:38 +0000</pubDate>
  <lastBuildDate>Tue, 06 Jul 2010 10:15:44 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=16904</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Dynamic Tooltips for MenuItems :  Two points further to this post:  1....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16904&amp;PID=59230&amp;title=dynamic-tooltips-for-menuitems#59230</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4162">mfproudman</a><br /><strong>Subject:</strong> 16904<br /><strong>Posted:</strong> 06 July 2010 at 10:15am<br /><br /><DIV></DIV><DIV>Two points further to this post:</DIV><DIV>&nbsp;</DIV><DIV>1.&nbsp; I made a mistake in the original post, and cut and pasted the wrong code.</DIV><DIV>&nbsp;</DIV><DIV><DIV></DIV><DIV></DIV><DIV></DIV>Handling WM_XTP_CONTROLSELECTED works (almost - see point 2 below) with CXTPControl::SetTooltip() _when called from CMainFrame_ to update the tooltip on the application main menu (or a submenu thereof).</DIV><DIV>&nbsp;</DIV><DIV>But it does not work when called to update a Context right-click popup menu invoked with TrackPopupMenu() from a view.&nbsp; In that case, I get my trace, but no tooltip.&nbsp; In&nbsp;other words, the following code&nbsp;is invoked, but puts no toolitp on the context menu:</DIV><DIV><P>LRESULT CMyView::OnXTPControlSelected(WPARAM wParam, LPARAM lParam)</P><DIV>{</DIV><P>&nbsp;&nbsp;&nbsp; CXTPControl * ctrl = (CXTPControl *)wParam;</P><P><FONT color=#0000ff size=2><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp; if</FONT></FONT><FONT size=2>(!ctrl) </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> NULL;</P><P>&nbsp;&nbsp;&nbsp; CString msg;</P><P>&nbsp;&nbsp;&nbsp; msg.Format(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"id=%d\n"</FONT></FONT><FONT size=2>, ctrl-&gt;GetID());</P><P>&nbsp;&nbsp;&nbsp; TRACE(msg);</P><P>&nbsp;&nbsp;&nbsp; ctrl-&gt;SetTooltip(msg);</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp; return</FONT></FONT><FONT size=2> lParam;</P><P>}</P><DIV></FONT>Is there a way to get dynamic tool tips on a context menu?</DIV><DIV>&nbsp;</DIV><DIV>2.&nbsp; Even when called from CMainFrame to update the application menu menu, the WM_XTP_CONTROLSELECTED message gets there late.&nbsp; (There is a forum post of 16 December 2009 on this, but no followup).&nbsp; WM_XTP_CONTROLSELECTED gets handled _after_ the tooltip is displayed, so the first tooltip the user sees is the _second last_ tooltip set with CXTPControl::SetTooltip().</DIV><DIV>&nbsp;</DIV><DIV>Is there a way around this?&nbsp; Either another message (WM_XTP_CONTROL_ABOUT_TO_BE_SELECTED?), or a way of intercepting something like WM_XTP_INITMENU, so that a current and up to date tooltip can be provided?</DIV><DIV>&nbsp;</DIV><DIV>I'm sure that more than one developer has wrestled with this.</DIV><DIV>&nbsp;</DIV><DIV>Thanks for any input,</DIV><DIV>&nbsp;</DIV><DIV>Mark Proudman</DIV><DIV><a href="mailto:mfproudman@gmail" target="_blank">mfproudman@gmail</A></DIV><DIV>&nbsp;</DIV></DIV>]]>
   </description>
   <pubDate>Tue, 06 Jul 2010 10:15:44 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16904&amp;PID=59230&amp;title=dynamic-tooltips-for-menuitems#59230</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Tooltips for MenuItems :   We would like to have dynamic...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16904&amp;PID=59189&amp;title=dynamic-tooltips-for-menuitems#59189</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4162">mfproudman</a><br /><strong>Subject:</strong> 16904<br /><strong>Posted:</strong> 02 July 2010 at 9:24am<br /><br /><DIV></DIV><DIV>&nbsp;</DIV><DIV>We would like to have dynamic tooltips associated with Toolbar and Menu items.&nbsp; The purpose would be to tell users why the update handler has&nbsp;turned a menu or toolbar selection on or off.</DIV><DIV>&nbsp;</DIV><DIV>I have the obvious static resource-based tooltips working for MenuBars and Toolbars, but is there a way to change text dynamically, perhaps from the OnUpdateUI handler?</DIV><DIV>&nbsp;</DIV><DIV>I have tried handling WM_XTP_CONTROLSELECTED.&nbsp;&nbsp;I get a pointer to the control and hence to the ID of the menu item, but SetTooltip() seems to have no effect.&nbsp; In the following, I get the TRACE, but not the tooltip (I get the static resource-based tooltip string):</DIV><DIV>&nbsp;</DIV><FONT size=2><P>LRESULT CMainFrame::OnXTPControlSelected(WPARAM wParam, LPARAM lParam)</P><DIV>{</DIV><P>&nbsp;&nbsp;&nbsp; CXTPControl * ctrl = (CXTPControl *)wParam;</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp; if</FONT></FONT><FONT size=2>(!ctrl) </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> NULL;</P><P>&nbsp;&nbsp;&nbsp; CString msg;</P><P>&nbsp;&nbsp;&nbsp; msg.Format(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"id=%d\n"</FONT></FONT><FONT size=2>, ctrl-&gt;GetID());</P><P>&nbsp;&nbsp;&nbsp; TRACE(msg);</P><P>&nbsp;&nbsp;&nbsp; ctrl-&gt;SetTooltip(msg);</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>&nbsp;&nbsp;&nbsp; return</FONT></FONT><FONT size=2> lParam;</P><P>}</P><P>Is this supported?&nbsp; Controlling at runtime the tooltip associated with a menu item must be possible; it seems a pretty obvious idea.</P><DIV></DIV><P>Any comments appreciated,</P><DIV></DIV><DIV>&nbsp;</DIV><DIV>Mark Proudman</DIV><DIV>mfproudman@gmail.com</DIV></FONT>]]>
   </description>
   <pubDate>Fri, 02 Jul 2010 09:24:26 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16904&amp;PID=59189&amp;title=dynamic-tooltips-for-menuitems#59189</guid>
  </item> 
 </channel>
</rss>