<?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 : Removing a menu item</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Removing a menu item]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 21 Apr 2026 19:42:25 +0000</pubDate>
  <lastBuildDate>Thu, 17 Apr 2008 14:19:54 +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=10245</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[Removing a menu item : try CXTPControls* pControls =...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33859&amp;title=removing-a-menu-item#33859</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 17 April 2008 at 2:19pm<br /><br /><FONT size=2>try&nbsp;</FONT><P>CXTPControls* pControls = pMenuBar-&gt;GetControls();</P><P>CXTPControl* pControl = pControls-&gt;GetAt(4); <FONT color=#008000 size=2>// Utilities Menu item</P></FONT><FONT size=2><P>CXTPControls* pUtilCtrls = pControl-&gt;<strong>GetCommandBar()-&gt;</strong>GetControls(); // POpup Controls</P><P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nItemCount = pUtilCtrls-&gt;GetCount();</P><P>CXTPControl* pUtilMenuItem = pUtilCtrls-&gt;GetAt(13);</P><P></P><P><strong>pUtilCtrls</strong>-&gt;Remove(pUtilMenuItem); </FONT></P>]]>
   </description>
   <pubDate>Thu, 17 Apr 2008 14:19:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33859&amp;title=removing-a-menu-item#33859</guid>
  </item> 
  <item>
   <title><![CDATA[Removing a menu item : Thanks Oleg,  Yes, I agree that...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33855&amp;title=removing-a-menu-item#33855</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4092">71SoCal</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 17 April 2008 at 1:47pm<br /><br />Thanks Oleg,<DIV>&nbsp;</DIV><DIV>Yes, I agree that this code shouldn't be removing an item in its Update handler.&nbsp; Someone coded it that way long ago, so I&nbsp;moved it elsewhere.</DIV><DIV>&nbsp;</DIV><DIV>The problem still exists though, that I can't delete that menu item.&nbsp; I don't understand how CodeJock organizes the objects.&nbsp; I've got the hierarchy chart.</DIV><DIV>&nbsp;</DIV><DIV>On my mainframe menu, I want to remove the 14th item down on the 5th menu...I hope I explained that correctly.</DIV><DIV>&nbsp;</DIV><DIV>Here's how I would expect it to be coded:</DIV><DIV>&nbsp;</DIV><FONT size=2><P>CXTPCommandBars* pCommandBars = GetCommandBars();</P><P>CXTPMenuBar* pMenuBar = pCommandBars-&gt;SetMenu(_T(</FONT><FONT color=#a31515 size=2>"Menu Bar"</FONT><FONT size=2>), IDR_MAINFRAME);</P><P>pMenuBar-&gt;SetFlags(xtpFlagAddMDISysPopup);</P><P>pMenuBar-&gt;SetShowGripper(</FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>);</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (!GetAcesConfig()-&gt;GetSafetyRecallNoticesEnabledFlag())</P><P>{</P><P></FONT><FONT color=#008000 size=2>// Remove the safety recall notice menu item</P></FONT><FONT size=2><P>CXTPControls* pControls = pMenuBar-&gt;GetControls();</P><P>CXTPControl* pControl = pControls-&gt;GetAt(4); </FONT><FONT color=#008000 size=2>// Utilities Menu item</P></FONT><FONT size=2><P>CXTPControls* pUtilCtrls = pControl-&gt;GetControls();</P><P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nItemCount = pUtilCtrls-&gt;GetCount();</P><P>CXTPControl* pUtilMenuItem = pUtilCtrls-&gt;GetAt(13);</P><P></P><P>pControls-&gt;Remove(pUtilMenuItem); </FONT><FONT color=#008000 size=2>//IDM_VIEW_RECALL_NOTICES</P><DIV></DIV><P>It crashes because the second Remove() call is out of index...it is referring to the top-level menu.&nbsp; How do I get to that secondary item to remove it?</P><DIV>I actually have this entered as a tech support request, so I apologize for the redundancy. If you answer there, I'll post back here for everyone else.</DIV><DIV>&nbsp;</DIV><DIV><DIV></DIV><DIV></DIV>Thanks,</DIV><DIV></DIV>Mike</FONT>]]>
   </description>
   <pubDate>Thu, 17 Apr 2008 13:47:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33855&amp;title=removing-a-menu-item#33855</guid>
  </item> 
  <item>
   <title><![CDATA[Removing a menu item : Right. Actually do you really...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33801&amp;title=removing-a-menu-item#33801</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 17 April 2008 at 1:16am<br /><br />Right. Actually do you really need to delete it in Updatehandler? Maybe you can Hide/show it instead?<DIV>&nbsp;</DIV><DIV>pControl-&gt;SetVisible(TRUE/FALSE);</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>also to prevent this problem add pCmdUI&gt;Enable(FALSE);&nbsp; before you delete control.</DIV>]]>
   </description>
   <pubDate>Thu, 17 Apr 2008 01:16:11 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33801&amp;title=removing-a-menu-item#33801</guid>
  </item> 
  <item>
   <title><![CDATA[Removing a menu item : I just realized that the m_pControl...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33778&amp;title=removing-a-menu-item#33778</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4092">71SoCal</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 16 April 2008 at 5:24pm<br /><br />I just realized that the m_pControl should be deleted at this point???&nbsp; <DIV>&nbsp;</DIV><DIV>So now I'm wondering why the framework is calling the Enable() on that object...assuming is should be gone.&nbsp; Is there something else that needs to be done to get the object set to NULL?</DIV><DIV>&nbsp;</DIV><DIV>Thanks,</DIV><DIV>Mike</DIV>]]>
   </description>
   <pubDate>Wed, 16 Apr 2008 17:24:02 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33778&amp;title=removing-a-menu-item#33778</guid>
  </item> 
  <item>
   <title><![CDATA[Removing a menu item : Thanks for the response.   I...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33777&amp;title=removing-a-menu-item#33777</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4092">71SoCal</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 16 April 2008 at 5:19pm<br /><br />Thanks for the response.&nbsp; <DIV>&nbsp;</DIV><DIV>I added that code to my OnUpdateUI handler and it compiled and I was able to step past it.&nbsp; I'm still crashing though, and I'm hoping that you might have an idea why.</DIV><DIV>&nbsp;</DIV><DIV>As soon as I hit F5 (run), I end up crashing in this xtpcommandbar.cpp file code shown below&nbsp;(the red highlighted code is the actual crash line): <FONT color=#0000ff size=2></DIV><P>void</FONT><FONT size=2> CXTPCommandBar::CCommandBarCmdUI::Enable(BOOL bOn){</P><P>m_bEnableChanged = TRUE;</P><P>ASSERT(m_pControl != NULL);</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (!m_pControl)</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>;</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (m_pControl-&gt;GetAction())</P><P>{</P><P><FONT color=#ff0000>m_pControl-&gt;SetEnabled(bOn ? -1 : FALSE);</FONT></P><P>}</P><P></FONT><FONT color=#0000ff size=2>else</P></FONT><FONT size=2><P>{</P><P>m_pControl-&gt;SetEnabled(bOn);</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (!bOn &amp;&amp; !m_bCheckedChanged) m_pControl-&gt;SetChecked(FALSE);</P><P>}</P><P>}</P><DIV></DIV><P>Before I step over that line of code, m_pControl has a value, but the data members inside don't seem to have valid data.</P><DIV>Any ideas would be appreciated.&nbsp; Thanks again...</DIV><DIV><DIV></DIV><DIV></DIV></DIV>-Mike</FONT>]]>
   </description>
   <pubDate>Wed, 16 Apr 2008 17:19:26 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33777&amp;title=removing-a-menu-item#33777</guid>
  </item> 
  <item>
   <title><![CDATA[Removing a menu item : Something lile:  CXTPControl*...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33743&amp;title=removing-a-menu-item#33743</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 16 April 2008 at 6:18am<br /><br />Something lile:<DIV>&nbsp;</DIV><DIV>CXTPControl* pControl = CXTPControl::FromUI(pCmdUI);</DIV><DIV>if (pControl) pControl-&gt;GetControls()-&gt;Remove(pControl);</DIV>]]>
   </description>
   <pubDate>Wed, 16 Apr 2008 06:18:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33743&amp;title=removing-a-menu-item#33743</guid>
  </item> 
  <item>
   <title><![CDATA[Removing a menu item : I&amp;#039;ve loaded a skin for my...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33721&amp;title=removing-a-menu-item#33721</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4092">71SoCal</a><br /><strong>Subject:</strong> 10245<br /><strong>Posted:</strong> 15 April 2008 at 6:51pm<br /><br />I've loaded a skin for my application, and added the following code to wrap my MainFrame menu:<DIV>&nbsp;</DIV><FONT size=2><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (!InitCommandBars())</P><P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> -1;</P><P></P><P>CXTPCommandBars* pCommandBars = GetCommandBars();</P><P></P><P>CXTPMenuBar* pMenuBar = pCommandBars-&gt;SetMenu(_T(</FONT><FONT color=#a31515 size=2>"Menu Bar"</FONT><FONT size=2>), IDR_MAINFRAME);</P><P>pMenuBar-&gt;SetShowGripper(</FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>);</P><DIV></DIV><DIV></DIV>The problem is that&nbsp;legacy code is trying to remove a menu item, and it's crashing the app:<DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><FONT size=2><P>pCmdUI-&gt;m_pMenu-&gt;RemoveMenu(pCmdUI-&gt;m_nID,MF_BYCOMMAND);</P></FONT><DIV>The m_pMenu object is NULL.&nbsp; Should I replace this call with a CodeJock call?&nbsp; And if so, what call is it...I can't find a RemoveMenu function on any of the objects.</DIV><DIV>&nbsp;</DIV><DIV>Thanks for any help...</DIV><DIV>&nbsp;</DIV><DIV>Mike</DIV></FONT>]]>
   </description>
   <pubDate>Tue, 15 Apr 2008 18:51:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=10245&amp;PID=33721&amp;title=removing-a-menu-item#33721</guid>
  </item> 
 </channel>
</rss>