<?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 Menu Shared Handler?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Dynamic Menu Shared Handler?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 27 Apr 2026 15:39:54 +0000</pubDate>
  <lastBuildDate>Thu, 03 May 2007 05:23:50 +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=7000</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 Menu Shared Handler? : Much better. Thank you! ]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22521&amp;title=dynamic-menu-shared-handler#22521</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1257">robosport</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 03 May 2007 at 5:23am<br /><br />Much better. Thank you!]]>
   </description>
   <pubDate>Thu, 03 May 2007 05:23:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22521&amp;title=dynamic-menu-shared-handler#22521</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Menu Shared Handler? : Hi,  your way is too difficult...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22520&amp;title=dynamic-menu-shared-handler#22520</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 03 May 2007 at 5:22am<br /><br /><DIV>Hi,</DIV><DIV>&nbsp;</DIV><DIV>your way is too difficult :) and user can press Enter instead click mouse.</DIV><DIV>&nbsp;</DIV><DIV>easy way is use ON_XTP_EXECUTE macro:</DIV><DIV>&nbsp;</DIV><DIV>ON_XTP_EXECUTE(ID_FAVORITE_LINK, OnFavorite)</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>void CMainFrame::OnFavorite(NMHDR* pNMHDR, LRESULT* pResult)<BR>{<BR>&nbsp;NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;<BR>&nbsp;AfxMessageBox(tagNMCONTROL-&gt;pControl-&gt;GetParameter());</DIV><DIV>&nbsp;*pResult = 1;<BR>}<BR></DIV><DIV>&nbsp;</DIV><DIV>check Samples\CommandBars\DynamicPopups&nbsp;it show how create dynamic favorites with same way.</DIV><DIV></DIV>]]>
   </description>
   <pubDate>Thu, 03 May 2007 05:22:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22520&amp;title=dynamic-menu-shared-handler#22520</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Menu Shared Handler? : I may have figured this out on...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22518&amp;title=dynamic-menu-shared-handler#22518</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1257">robosport</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 03 May 2007 at 4:32am<br /><br />I may have figured this out on my own. <DIV>&nbsp;</DIV><DIV>Here is what I did: </DIV><DIV>- Derived a custom menu item class from CXTPControlButton</DIV><DIV>- Override OnLButtonUp for my derived menu item.</DIV><DIV>- When adding the dynamic menu item to the controls list I use the Add&nbsp;function that lets me pass in my derived control instead of the version that lets me pass the control type.</DIV><DIV>- I don't use ON_COMMAND at all for custom menu item handling.</DIV><DIV>&nbsp;</DIV><DIV>This way works. Let me know if there is a better way.</DIV><DIV>&nbsp;</DIV><DIV>Thanks.</DIV>]]>
   </description>
   <pubDate>Thu, 03 May 2007 04:32:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22518&amp;title=dynamic-menu-shared-handler#22518</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Menu Shared Handler? : Okay, I went with the second option...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22516&amp;title=dynamic-menu-shared-handler#22516</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1257">robosport</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 03 May 2007 at 3:50am<br /><br />Okay, I went with the second option you suggested, namely the XTP specific one. <DIV>&nbsp;</DIV><DIV>Another embarrassing question came up. If they use a shared ID (one handler procedure set with ON_COMMAND) and&nbsp;I place a custom&nbsp;value in the CXTPControlButton using SetTag for example when creating the menu items, how do I get a pointer to the CXTPControlButton pressed from the handler function (so I can retreive the custom value)?</DIV><DIV>&nbsp;</DIV><DIV>The problem is ON_COMMAND handlers take no parameters so how do I get the CXTPControlButton that initated the command handler?</DIV>]]>
   </description>
   <pubDate>Thu, 03 May 2007 03:50:23 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22516&amp;title=dynamic-menu-shared-handler#22516</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Menu Shared Handler? : That was more of a newbie question...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22416&amp;title=dynamic-menu-shared-handler#22416</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1257">robosport</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 27 April 2007 at 3:54pm<br /><br /><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN lang=EN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'; mso-ansi-: EN">That was more of a newbie question than I thought and I'm suitably embarrassed. I learn something new every day. Thank you again Oleg!</P><DIV></DIV></SPAN>]]>
   </description>
   <pubDate>Fri, 27 Apr 2007 15:54:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22416&amp;title=dynamic-menu-shared-handler#22416</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Menu Shared Handler? : Hi,   You can use ON_COMMAND_RANGE...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22403&amp;title=dynamic-menu-shared-handler#22403</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 27 April 2007 at 6:54am<br /><br />Hi, <DIV>&nbsp;</DIV><DIV>You can use ON_COMMAND_RANGE macro:</DIV><DIV>ON_COMMAND_RANGE(MINRANGE, MAXRANGE, OnDynamicButtton)</DIV><DIV>&nbsp;</DIV><DIV>void CMainFrame::OnDynamicButtton(UINT nButton)<BR>{<BR>}</DIV><DIV>&nbsp;</DIV><DIV>or specific for XTP Menus: use same ID for all dynamic buttons but assign some parameter/integer data for CXTPControl.</DIV>]]>
   </description>
   <pubDate>Fri, 27 Apr 2007 06:54:37 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22403&amp;title=dynamic-menu-shared-handler#22403</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamic Menu Shared Handler? : Sorry for the newb-like question...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22393&amp;title=dynamic-menu-shared-handler#22393</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1257">robosport</a><br /><strong>Subject:</strong> 7000<br /><strong>Posted:</strong> 27 April 2007 at 4:02am<br /><br />Sorry for the newb-like question but I've never needed dynamically generated menus in an MFC/XTP app before. <DIV></DIV><DIV>&nbsp;</DIV><DIV>When adding each&nbsp;new button to a popup menu I am giving each button a unique ID at run time. There are literally thousands of them in a relatively simply and organized menu hierarchy.</DIV><DIV>&nbsp;</DIV><DIV>The question is: Do I need to enter a member function/procedure&nbsp;for each unique ID's event handler or is there a way to have a single shared handler for these dynamically generated buttons, that can simply accept the unique ID as a parameter and deal with it?</DIV><DIV>&nbsp;</DIV><DIV>Thanks in advance.</DIV>]]>
   </description>
   <pubDate>Fri, 27 Apr 2007 04:02:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7000&amp;PID=22393&amp;title=dynamic-menu-shared-handler#22393</guid>
  </item> 
 </channel>
</rss>