<?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 : How to get Submenu?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : How to get Submenu?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 20 May 2026 10:26:52 +0000</pubDate>
  <lastBuildDate>Wed, 07 Jan 2009 13:33:22 +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=12627</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[How to get Submenu? : Hello,  Guess you check wrong...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=44254&amp;title=how-to-get-submenu#44254</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 12627<br /><strong>Posted:</strong> 07 January 2009 at 1:33pm<br /><br />Hello,<DIV>&nbsp;</DIV><DIV>Guess you check wrong controls.</DIV><DIV>&nbsp;</DIV><DIV>I very recommend use standard MFC Update handlers - as advantage you don't need afraid that your user remove/move/delete or copy this control in Customization dialog.</DIV><DIV>&nbsp;</DIV><DIV>Add </DIV><DIV>&nbsp;</DIV><DIV>ON_UPDATE_COMMAND_UI(ID_P0_ID, OnUpdateP0)</DIV><DIV>&nbsp;</DIV><DIV>and </DIV><DIV>void CMainFrame::OnUpdateP0(CCmdUI* pCmdUI)<BR>{<BR>&nbsp;pCmdUI-&gt;SetCheck(m_bP0IsChecked);<BR>}<BR>&nbsp;</DIV>]]>
   </description>
   <pubDate>Wed, 07 Jan 2009 13:33:22 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=44254&amp;title=how-to-get-submenu#44254</guid>
  </item> 
  <item>
   <title><![CDATA[How to get Submenu? :   I now have the code below....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=42762&amp;title=how-to-get-submenu#42762</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4346">kent_t</a><br /><strong>Subject:</strong> 12627<br /><strong>Posted:</strong> 10 November 2008 at 2:56pm<br /><br />I now have the code below. The cnt return value reflects the correct number of items in the associated menus. I believe I have the correct menu "controls." They are MenuItems, aren't they. The id's obtained from the CXTPControl.GetID() calls are correct. The controls have the resource.h ID's that they should.<br><br>Note: mpMainMenuBar is set in the OnCreate function above.<br><br>The SetCheck call does NOTHING. Zero. I am losing faith rapidly.<br><br><table width="99%"><tr><td><pre class="BBcode">&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; CMainFrame* pMF = (CMainFrame*)AfxGetMainWnd();<br><br>&nbsp; &nbsp; CXTPCommandBar* pBar = pMF-&gt;mpMainMenuBar-&gt;GetControl(2)-&gt;GetCommandBar();<br>&nbsp;&nbsp;&nbsp; int cnt = pBar-&gt;GetControlCount();<br>&nbsp;&nbsp;&nbsp; CXTPCommandBar* pSMenu = pBar-&gt;GetControl(4)-&gt;GetCommandBar();<br>&nbsp;&nbsp;&nbsp; cnt = pSMenu-&gt;GetControlCount();<br><br>&nbsp;&nbsp;&nbsp; CXTPControl* p0 = pSMenu-&gt;GetControl(0);<br>&nbsp;&nbsp;&nbsp; p0-&gt;SetChecked( FALSE );<br>&nbsp;&nbsp;&nbsp; int id0 = p0-&gt;GetID();<br><br>&nbsp;&nbsp;&nbsp; CXTPControl* p1 = pSMenu-&gt;GetControl(1);<br>&nbsp;&nbsp;&nbsp; p1-&gt;SetChecked( TRUE );<br>&nbsp;&nbsp;&nbsp; int id1 = p1-&gt;GetID();<br></pre></td></tr></table><br>Please Advise.<br><br>]]>
   </description>
   <pubDate>Mon, 10 Nov 2008 14:56:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=42762&amp;title=how-to-get-submenu#42762</guid>
  </item> 
  <item>
   <title><![CDATA[How to get Submenu? : Hi, try  CXTPMenuBar* pMB =...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=42680&amp;title=how-to-get-submenu#42680</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 12627<br /><strong>Posted:</strong> 07 November 2008 at 5:12am<br /><br />Hi,<DIV>try</DIV><DIV>&nbsp;</DIV><DIV>CXTPMenuBar* pMB = pCB-&gt;GetMenuBar();<BR>pMB-&gt;GetControl(0)-&gt;GetCommandBar();</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 07 Nov 2008 05:12:35 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=42680&amp;title=how-to-get-submenu#42680</guid>
  </item> 
  <item>
   <title><![CDATA[How to get Submenu? :  CJ Version: 12.0.0, MSVC++ 2005,...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=42672&amp;title=how-to-get-submenu#42672</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4346">kent_t</a><br /><strong>Subject:</strong> 12627<br /><strong>Posted:</strong> 06 November 2008 at 5:55pm<br /><br />CJ Version: 12.0.0, MSVC++ 2005, MFC<br><br>I want to * programmatically* change a Submenu from within a standard MFC MAIN menu with a check mark. There should be a CheckMenuItem(...) call somewhere, right?<br><br>I've looked through all the CommandBar samples. No joy. (Maybe I missed something.)<br><br>I have this in CMainFrame::OnCreate(...);<br>...<br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp;&nbsp;&nbsp; CXTPCommandBars* pCommandBars = GetCommandBars();<br>&nbsp;&nbsp; &nbsp;mpMainMenuBar = pCommandBars-&gt;SetMenu(_T("Menu Bar"), IDR_MAINFRAME);<br>&nbsp;&nbsp; &nbsp;mpMainMenuBar-&gt;SetFlags(xtpFlagAddMDISysPopup);<br></pre></td></tr></table><br><br>I can call mpMainMenuBar from other class's and it provides me the same behavior as below.<br><br>In another class I call:<br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMainFrame* pMF = (CMainFrame*)AfxGetMainWnd();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPCommandBars* pCB = pMF-&gt;GetCommandBars();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPMenuBar* pMB = pCB-&gt;GetMenuBar();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // id is always "1", wrong id<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int id = pMB-&gt;GetBarID();<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // none of the returned pointers are usefull<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPControl* pc = pCB-&gt;FindControl( xtpControlPopup, ID_VIEW_PROPON, TRUE, FALSE );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPMenuBarMDIMenus* pmdi = pMB-&gt;GetMDIMenus();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPMenuBarMDIMenuInfo* pinfo = pmdi-&gt;Lookup( ID_VIEW_PROPON );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // GetMenu always returns NULL<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMenu* pcm = pMB-&gt;GetMenu();<br></pre></td></tr></table><br><br>Sadness.<br><br>This is how you would do it in normal MFC. From MS example.<br><table width="99%"><tr><td><pre class="BBcode"><br>CMenu* menu_bar = AfxGetMainWnd()-&gt;GetMenu();   <br>CMenu* file_menu = menu_bar-&gt;GetSubMenu(0);    <br></pre></td></tr></table><br><br>Any help to achieve this would be appreciated.<br><br>Thank you.<br>]]>
   </description>
   <pubDate>Thu, 06 Nov 2008 17:55:39 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=12627&amp;PID=42672&amp;title=how-to-get-submenu#42672</guid>
  </item> 
 </channel>
</rss>