<?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 : Dynamically Adding Menu Items</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Dynamically Adding Menu Items]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 20 Apr 2026 06:59:03 +0000</pubDate>
  <lastBuildDate>Sun, 05 Sep 2004 03:31:30 +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=1138</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[Dynamically Adding Menu Items : use CXTPCommandBars::Add method...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1138&amp;PID=2975&amp;title=dynamically-adding-menu-items#2975</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 1138<br /><strong>Posted:</strong> 05 September 2004 at 3:31am<br /><br /><P>use CXTPCommandBars::Add method to add dynamic items:</P><P>pReports-&gt;Add(xtpControlButton, dwCmdID);</P><P>&nbsp;</P><P>or try to review DynamicPopups sample.</P>]]>
   </description>
   <pubDate>Sun, 05 Sep 2004 03:31:30 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1138&amp;PID=2975&amp;title=dynamically-adding-menu-items#2975</guid>
  </item> 
  <item>
   <title><![CDATA[Dynamically Adding Menu Items : I am a new user to the Pro version...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1138&amp;PID=2962&amp;title=dynamically-adding-menu-items#2962</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=721">cdrew</a><br /><strong>Subject:</strong> 1138<br /><strong>Posted:</strong> 03 September 2004 at 6:28pm<br /><br /><P>I am a new user to the Pro version of toolkit and am trying to get to grips with the menus and toolbars which are very different from their MFC equivalents.&nbsp; As such I am updating my application to work as it did before under the toolkit.</P><P>I want to add a list of MRU reports to a Reports menu.&nbsp; I have added a handler for OnInitCommandsPopup, ensured that the popup menu is in fact the Reports menu and then wondered how to add items to it.</P><P>My thoughts were to create a CMenu popup menu and then add my new items to it, finally calling LoadMenu to load the CMenu into the command bar.&nbsp; This should have loaded a menu with 10 items but instead I only got the one and this was disabled.</P><P>I have used the following code:</P><P>&nbsp;&nbsp;&nbsp; // get the list of commands for the popup.<BR>&nbsp;&nbsp;&nbsp; CXTPControls* pCommandList = pCommandBar-&gt;GetControls();</P><P>&nbsp;&nbsp; // Is this the ReportWizard menu?<BR>&nbsp;&nbsp; CXTPControl* pReports = pCommandList-&gt;FindControl(xtpControlButton, ID_AUDIT_REPORT, TRUE, FALSE);<BR>&nbsp;&nbsp;&nbsp; if (!pReports)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</P><P>// OK - we are popping up the Reports Menu - let's build the menu first<BR>&nbsp;CMenu&nbsp; PopupMenu;<BR>&nbsp;PopupMenu.CreatePopupMenu ();</P><P>&nbsp;DWORD dwCmdID = ID_FILE_MRU_FILE1;<BR>&nbsp;for (DWORD dw=0; dw&lt;RptIni.m_listMRUReports.GetCount(); dw++)<BR>&nbsp;{<BR>&nbsp;&nbsp;PopupMenu.AppendMenu(MF_STRING ,dwCmdID++ ,RptIni.m_listMRUReports&#091;dw&#093;);&nbsp;<BR>&nbsp;}</P><P>&nbsp;// ...add ReportWizard to the end of the menu<BR>&nbsp;PopupMenu.AppendMenu (MF_SEPARATOR ,0 ,"");<BR>&nbsp;PopupMenu.AppendMenu (MF_STRING ,ID_AUDIT_REPORT ,"Report&amp;Wizard");</P><P>&nbsp;// ...and then load this menu<BR>&nbsp;pCommandBar-&gt;LoadMenu(&amp;PopupMenu ,TRUE);<BR></P><P>This should have created loads of entries but instead I get 1 entry in the menu from the array of reports and the final ReportWizard entry - however the menu items entered in the loop are all disabled.</P><P>I have also added </P><P>&nbsp;ON_COMMAND_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, OnMRUReport)</P><P>to my message map so it should (and did under MFC) work.</P><P>Any suggestions would be very welcome</P>]]>
   </description>
   <pubDate>Fri, 03 Sep 2004 18:28:01 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1138&amp;PID=2962&amp;title=dynamically-adding-menu-items#2962</guid>
  </item> 
 </channel>
</rss>