<?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 : Reordering the Quick Access Toolbar</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Reordering the Quick Access Toolbar]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 28 Apr 2026 19:16:50 +0000</pubDate>
  <lastBuildDate>Tue, 04 Mar 2008 05:16:36 +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=9638</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[Reordering the Quick Access Toolbar : Hi,  Yes, right :( problem in...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=9638&amp;PID=31875&amp;title=reordering-the-quick-access-toolbar#31875</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 9638<br /><strong>Posted:</strong> 04 March 2008 at 5:16am<br /><br />Hi, <DIV>Yes, right :( problem in our sources that assumes that Quick Acccess controls always added in the end of list.</DIV><DIV>&nbsp;</DIV><DIV>Here fix for source:</DIV><DIV>&nbsp;</DIV><DIV>int CXTPRibbonQuickAccessControls::IndexOf(CXTPControl* pControl) const<BR>{<BR>&nbsp;for (int nIndex = GetCount() - 1; nIndex &gt;= 0; nIndex--)<BR>&nbsp;{<BR>&nbsp;&nbsp;if (GetAt(nIndex) == pControl)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return nIndex;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;return -1;<BR>}</DIV><DIV>void CXTPRibbonQuickAccessControls::OnControlAdded(CXTPControl* pControl)<BR>{<BR>&nbsp;int nIndex = IndexOf(pControl) + (((CXTPRibbonBar*)m_pParent)-&gt;GetSystemButton() ? 1 : 0);</DIV><DIV>&nbsp;m_pParent-&gt;GetControls()-&gt;InsertAt(pControl, nIndex);<BR>&nbsp;pControl-&gt;InternalAddRef();<BR>}</DIV><DIV>&nbsp;</DIV><DIV>Here your method to move:</DIV><DIV>&nbsp;</DIV><DIV>void CXTPRibbonCustomizeQuickAccessPage::OnButtonReset()<BR>{<BR>&nbsp;int nSel = m_lstQuickAccess.GetCurSel();<BR>&nbsp;&nbsp;&nbsp; if (nSel &lt; 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; CXTPControl* pControl = (CXTPControl*)m_lstQuickAccess.GetItemDataPtr(nSel);<BR>&nbsp;&nbsp;&nbsp; if (!pControl)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; CXTPRibbonQuickAccessControls* pQuickAccessControls = GetRibbonBar()-&gt;GetQuickAccessControls();<BR>&nbsp;&nbsp;&nbsp; if (!pQuickAccessControls)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</DIV><DIV>&nbsp;int nIndex = pQuickAccessControls-&gt;IndexOf(pControl);<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; pQuickAccessControls-&gt;AddClone(pControl, nIndex - 1);<BR>&nbsp;&nbsp;&nbsp; pQuickAccessControls-&gt;Remove(pControl);<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; GetRibbonBar()-&gt;OnRecalcLayout();<BR>&nbsp;&nbsp;&nbsp; RefreshQuickAccessList();</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Thanks</DIV>]]>
   </description>
   <pubDate>Tue, 04 Mar 2008 05:16:36 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=9638&amp;PID=31875&amp;title=reordering-the-quick-access-toolbar#31875</guid>
  </item> 
  <item>
   <title><![CDATA[Reordering the Quick Access Toolbar : I am trying to extend the Quick...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=9638&amp;PID=31354&amp;title=reordering-the-quick-access-toolbar#31354</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3003">mrmathis</a><br /><strong>Subject:</strong> 9638<br /><strong>Posted:</strong> 19 February 2008 at 6:26pm<br /><br />I am trying to extend the Quick Access customization page by adding "Move Up" and "Move Down" buttons a la MS Word's version of this dialog, but I'm not having much success.&nbsp; Here is some sample code from my CustomizeQAT::OnMoveUp handler that can be used to replace the body of CXTPRibbonCustomizeQuickAccessPage::OnButtonReset to illustrate what I am trying to do.<DIV></DIV><DIV></DIV><DIV></DIV><DIV></DIV><FONT color=#800000 size=1><FONT color=#0000ff size=1><FONT face="Courier New, Courier, mono"><FONT size=1><P></FONT><FONT face="Courier New, Courier, mono"><FONT size=2><FONT color=#000000></P><DIV><FONT color=#0000ff>// Swap the selected item in the Quick Access list with the previous item<BR>void MyQuickAccessPage::OnButtonMoveUp()<BR>{<BR>&nbsp;&nbsp;&nbsp; if (!GetDlgItem(IDC_RIBBONBUTTON_MOVE_UP)-&gt;IsWindowEnabled())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; int nSel = m_lstQuickAccess.GetCurSel();<BR>&nbsp;&nbsp;&nbsp; if (nSel &lt; 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; CXTPControl* pControlInList = (CXTPControl*)m_lstQuickAccess.GetItemDataPtr(nSel);<BR>&nbsp;&nbsp;&nbsp; if (!pControlInList)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; CXTPRibbonQuickAccessControls* pQuickAccessControls = GetRibbonBar()-&gt;GetQuickAccessControls();<BR>&nbsp;&nbsp;&nbsp; if (!pQuickAccessControls)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; CXTPControl* pControlInQAT = pQuickAccessControls-&gt;FindControl(pControlInList-&gt;GetID());<BR>&nbsp;&nbsp;&nbsp; if (!pControlInQAT)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; // I'm not convinced that GetIndex is the same as the position in the array,<BR>&nbsp;&nbsp;&nbsp; // so this may not be correct.&nbsp; Is GetIndex 1-based rather than 0-based?<BR>&nbsp;&nbsp;&nbsp; long nPrev = pControlInQAT-&gt;GetIndex() - 1 - 1;<BR>&nbsp;&nbsp;&nbsp; if (nPrev &lt; 0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; // This was my first try.&nbsp; It asserts and crashes in CXTPControls::MoveBefore<BR>&nbsp;&nbsp;&nbsp; // because pQuickAccessControls != pControlInQAT-&gt;GetControls()<BR>&nbsp;&nbsp;&nbsp; //pQuickAccessControls-&gt;MoveBefore(pControlInQAT, (int)nPrev);</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; // This seems like it would work.&nbsp; It does result in the objects in the list<BR>&nbsp;&nbsp;&nbsp; // control swapping, but no corresponding change happens on the QAT.</FONT></DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; pQuickAccessControls-&gt;AddClone(pControlInList, nPrev);<BR>&nbsp;&nbsp;&nbsp; pQuickAccessControls-&gt;Remove(pControlInQAT);</FONT></DIV><DIV><FONT color=#0000ff></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; GetRibbonBar()-&gt;OnRecalcLayout();</FONT></DIV><DIV><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; RefreshQuickAccessList();<BR>}<BR></FONT></DIV><DIV></FONT></FONT></FONT></FONT><FONT face="Arial, Helvetica, sans-serif" color=#000000 size=2></FONT>&nbsp;</DIV><DIV><FONT face="Arial, Helvetica, sans-serif" color=#000000 size=2>I wrote some code to dump the QAT try to track what is going on and called it from the debugger at&nbsp;strategic points.&nbsp;Here's that function:</FONT></DIV><DIV><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono" size=2>void DumpQAT()<BR>{<BR>&nbsp;&nbsp;&nbsp; . . . get the ribbon bar . . .<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (CXTPRibbonQuickAccessControls* pQuickAccessControls = pRibbonBar-&gt;GetQuickAccessControls())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int nCount = pQuickAccessControls-&gt;GetCount();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRACE("Count: %d\n", nCount);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int n = 0; n &lt; nCount; ++n)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (CXTPControl* pControl = pQuickAccessControls-&gt;GetAt(n))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int nID = pControl-&gt;GetID();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long nIndex = pControl-&gt;GetIndex();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CString strName = pControl-&gt;GetCaption();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRACE("%d: %#010x&nbsp; %5d&nbsp; %4d&nbsp; %s\n", n, pControl, nID, nIndex, (LPCSTR)strName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR></FONT></DIV><DIV><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV><DIV><FONT face=Arial color=#000000 size=2>Before the call to AddClone, I had this:</FONT></DIV><DIV><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono" size=2>Count: 6<BR>0: 0x0a2b9548&nbsp; 57600&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp; &amp;New<BR>1: 0x0a2b9820&nbsp; 57601&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; &amp;Open<BR>2: 0x0a0c4630&nbsp; 57603&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; &amp;Save<BR>3: 0x0a2b9270&nbsp; 57607&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp; &amp;Print<BR>4: 0x1f01c6b8&nbsp; 40002&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp; Send To Mail Recipient<BR>5: 0x1f334bf8&nbsp; 40003&nbsp;&nbsp;&nbsp;&nbsp; 6&nbsp; Send To Routing Recipient</FONT></DIV><DIV>&nbsp;</DIV><DIV><FONT face="Arial, Helvetica, sans-serif" color=#000000 size=2>After that call, I had what I expected in terms of overall order, although the index column seems odd:<BR></FONT></DIV><DIV><FONT face="Courier New, Courier, mono" size=2>Count: 7<BR>0: 0x0a2b9548&nbsp; 57600&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp; &amp;New<BR>1: 0x0a2b9820&nbsp; 57601&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; &amp;Open<BR>2: 0x0a0c4630&nbsp; 57603&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; &amp;Save<BR>3: 0x0a2b9270&nbsp; 57607&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp; &amp;Print<BR>4: 0x1f334da0&nbsp; 40003&nbsp;&nbsp;&nbsp;&nbsp; 7&nbsp; Send To Routing Recipient<BR>5: 0x1f01c6b8&nbsp; 40002&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp; Send To Mail Recipient<BR>6: 0x1f334bf8&nbsp; 40003&nbsp;&nbsp;&nbsp;&nbsp; 6&nbsp; Send To Routing Recipient</FONT></DIV><DIV><FONT face="Courier New, Courier, mono" size=2></FONT>&nbsp;</DIV><DIV><FONT face="Arial, Helvetica, sans-serif" color=#000000 size=2>After the call to Remove, I got this:</FONT></DIV><DIV><BR><FONT face="Courier New, Courier, mono" size=2>Count: 6<BR>0: 0x0a2b9548&nbsp; 57600&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp; &amp;New<BR>1: 0x0a2b9820&nbsp; 57601&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; &amp;Open<BR>2: 0x0a0c4630&nbsp; 57603&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; &amp;Save<BR>3: 0x0a2b9270&nbsp; 57607&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp; &amp;Print<BR>4: 0x1f334da0&nbsp; 40003&nbsp;&nbsp;&nbsp;&nbsp; 6&nbsp; Send To Routing Recipient<BR>5: 0x1f01c6b8&nbsp; 40002&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp; Send To Mail Recipient</FONT></DIV><DIV><FONT face="Courier New, Courier, mono" color=#000000 size=2></FONT>&nbsp;</DIV><DIV><FONT size=2><FONT face=Arial color=#000000>The part that throws me is the index, which I believe is contributing to me not seeing the results I expect.&nbsp; Notice that "Sen<FONT face="Arial, Helvetica, sans-serif">d to Routing Recipient" has an index of 6, when I would expect it to have 5 and "Send to Mail Recipient" to have 6.&nbsp; I stepped all the way through Remove into </FONT></FONT><FONT face="Courier New, Courier, mono"><FONT color=#0000ff size=1><FONT face="Arial, Helvetica, sans-serif"><FONT size=2><FONT color=#800080>CXTPControls</FONT><FONT color=#000080>::</FONT><FONT color=#000000>RefreshIndexes and saw the indices recomputed sequentially, but I'm not positive that the correct thing is getting recomputed.&nbsp; There are controls visited in that loop that I didn't expect to see (eg CXTPRibbonScrollableBar::CControlGroupsScroll, CXTPRibbonBarControlQuickAccessPopup).</FONT></FONT></FONT></FONT></FONT></FONT></DIV><DIV><FONT size=2><FONT face="Courier New, Courier, mono"><FONT color=#0000ff size=1><FONT face="Arial, Helvetica, sans-serif"><FONT color=#000000 size=2></FONT></FONT></FONT></FONT></FONT>&nbsp;</DIV><DIV><FONT size=2><FONT face="Courier New, Courier, mono"><FONT color=#0000ff size=1><FONT face="Arial, Helvetica, sans-serif"><FONT color=#000000 size=2>Can someone enlighten me?&nbsp; I went into this thinking it shouldn't be too difficult.</FONT></FONT></FONT></FONT></FONT></DIV><DIV><FONT size=2><FONT face="Courier New, Courier, mono"><FONT color=#0000ff size=1><FONT face="Arial, Helvetica, sans-serif"><FONT color=#000000 size=2></FONT></FONT></FONT></FONT></FONT>&nbsp;</DIV><DIV><FONT size=2><FONT face="Courier New, Courier, mono"><FONT color=#0000ff size=1><FONT face="Arial, Helvetica, sans-serif"><FONT color=#000000 size=2></FONT><FONT size=1><FONT color=#000000 size=2></FONT>&nbsp;</DIV></FONT></FONT></FONT></FONT></FONT></FONT></FONT>]]>
   </description>
   <pubDate>Tue, 19 Feb 2008 18:26:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=9638&amp;PID=31354&amp;title=reordering-the-quick-access-toolbar#31354</guid>
  </item> 
 </channel>
</rss>