<?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 create a fixed toolbar</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Articles and Tutorials : How to create a fixed toolbar]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 18:34:32 +0000</pubDate>
  <lastBuildDate>Sat, 12 Jun 2010 12:02:17 +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=16791</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 create a fixed toolbar :   Hello MarioYes you are right.I...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58910&amp;title=how-to-create-a-fixed-toolbar#58910</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6154">elmue</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 12 June 2010 at 12:02pm<br /><br />Hello Mario<br><br>Yes you are right.<br>I deleted the file GUI_VisualStudio_vc60.xml.<br>And now the flag works.<br><br>When changing the code you must always delete this XML file or disable the code the loads the configuration otherwise any change at the code is ignored and the old configuration is loaded from the XML file.<br><br>But it makes a big difference if you use either my code in RecalcLayout or alternately the flag Stretched.<br>This difference becomes visible when you resize the window:<br><br><img src="uploads/20100613_212943_DifferenceToolb.gif" height="373" width="744" border="0"><br><br><br>Elmü<br>]]>
   </description>
   <pubDate>Sat, 12 Jun 2010 12:02:17 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58910&amp;title=how-to-create-a-fixed-toolbar#58910</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar :  my code works for all toolbars...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58897&amp;title=how-to-create-a-fixed-toolbar#58897</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 11 June 2010 at 10:32am<br /><br />my code works for all toolbars as seen below, maybe you load some old layout after setting this flag?&nbsp; try to comment out any load settings\layout?<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //CXTPPropExchangeSection pxNormalLayout(px.GetSection(_T("NormalLayout")));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //ExchangeLayout(&amp;pxNormalLayout);<br><br><img src="uploads/20100611_103045_tc2.png" height="127" width="968" border="0">]]>
   </description>
   <pubDate>Fri, 11 Jun 2010 10:32:15 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58897&amp;title=how-to-create-a-fixed-toolbar#58897</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar : Hello MarioThanks for the screenshot.It...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58884&amp;title=how-to-create-a-fixed-toolbar#58884</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6154">elmue</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 10 June 2010 at 10:18am<br /><br />Hello Mario<br><br>Thanks for the screenshot.<br>It shows me that we are talking about two different things.<br><br>You made the Themebar wider.<br>I am surprised that this functions.<br>I can reproduce your screenshot.<br><br>BUT:<br>The same code applied to the toolbar, that I am talking about, (the command bar) STILL does NOT work.<br><br>Modify your line<br>pThemeBar-&gt;EnableDocking(xtpFlagStretchedShared);<br>into <br>pCommandBar-&gt;EnableDocking(xtpFlagStretchedShared);<br>or<br>pCommandBar-&gt;EnableDocking(xtpFlagStretched);<br><br>And you will see that the upper bar stays unchanged !<br><br>I also tried SetFlags() which doesn't work either.<br><br>Why does the code work for one toolbar but not for another one ?<br>Strange!<br>Is this a bug ?<br><br>Elmü<br>]]>
   </description>
   <pubDate>Thu, 10 Jun 2010 10:18:13 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58884&amp;title=how-to-create-a-fixed-toolbar#58884</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar : Trust me, the code works, it will...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58876&amp;title=how-to-create-a-fixed-toolbar#58876</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 09 June 2010 at 4:25pm<br /><br />Trust me, the code works, it will make toolbar take up 100% of the remaining space available<br><br><font face="Courier New, Courier, mono">pThemeBar-&gt;EnableDocking(xtpFlagStretchedShared); <br><br></font><img src="uploads/20100609_162405_tb.png" height="314" width="753" border="0"><br><br><br>]]>
   </description>
   <pubDate>Wed, 09 Jun 2010 16:25:25 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58876&amp;title=how-to-create-a-fixed-toolbar#58876</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar : Thank you SuperMario and Elmu...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58860&amp;title=how-to-create-a-fixed-toolbar#58860</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6064">lfoster</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 09 June 2010 at 9:04am<br /><br />Thank you SuperMario and Elmu for this solution. I think there is some confusion still as to what we are trying to achieve. SuperMario's suggestion of setting ShowExpandButton(FALSE) just removes the whole button which is not what we want.<br /><br />I have the drop down which correctly displays any buttons that do not fit on the toolbar. I still have the empty drop down though even when everything already fits on the toolbar. <br /><br />Ideally the drop down would have nothing in it if everything could be squeezed onto the toolbar instead of the single blank entry but I can live with this.<br /><br />Thanks again guys,<br /><br />Lewis]]>
   </description>
   <pubDate>Wed, 09 Jun 2010 09:04:38 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58860&amp;title=how-to-create-a-fixed-toolbar#58860</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar :  Hello MarioWould it be possible...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58851&amp;title=how-to-create-a-fixed-toolbar#58851</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6154">elmue</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 08 June 2010 at 8:49pm<br /><br />Hello Mario<br><br>Would it be possible that you try your code before posting here ?<br>Please *?*<br><br>&gt;&nbsp;&nbsp; <font face="Courier New, Courier, mono">pThemeBar-&gt;EnableDocking(xtpFlagStretchedShared); </font><br><br>This is EXACTLY what I did after your last posting.<br>And it defintiely does not change anything !<br><br>The toolbar stays the same size and does NOT fill 100% of the width of the window as my code does in RecalcLayout().<br><br>______________________<br><br>&gt; So <font face="Courier New, Courier, mono">ShowExpandButton(FALSE) </font>should be False, then use my code and you have what you were looking for.<br><br>This is one of the very first things that I tried and it does not do what you assume !<br><br>Look at this screenshot:<br><br><img src="uploads/20100608_203648_Commandbutt&#111;n.gif" height="118" width="284" border="0"><br><br>There are two symbols in the toolbar.<br>The upper one appears only if there are icons that don't fit into the toolbar, otherwise it disappears automatically.<br>The lower one is always there if <font face="Courier New, Courier, mono">ShowExpandButton(TRUE)</font>.<br><br>It would be perfect if I could turn them off separately and if I could define if I want to see "Add or remove buttons" in the menu.<br>But this is impossible.<br><br><font face="Courier New, Courier, mono">ShowExpandButton(FALSE) turns them BOTH COMPLETELY off and FOR EVER!</font><br><br>This means even if there are icons that don't fit into the toolbar there will be no symbol visible at all that the user could click on.<br><br>So up to now I did not find how to do what I want.<br>I think this is a missing feature.<br><br>Why isn't there an option like this:<br><br><font face="Courier New, Courier, mono">ShowExpandButton(xtpCommandButtonMoreIcons | </font><font face="Courier New, Courier, mono">xtpCommandButtonCustomizeMenu</font><font face="Courier New, Courier, mono">)<br><br>that would allow me to turn on and off individually what I want.<br><br>____________________________<br></font><br>Would you please try it before posting an answer ?<br>Thanks.<br><br>Elmü<br><br><br>]]>
   </description>
   <pubDate>Tue, 08 Jun 2010 20:49:53 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58851&amp;title=how-to-create-a-fixed-toolbar#58851</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar :  My solution assumed you did...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58842&amp;title=how-to-create-a-fixed-toolbar#58842</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 08 June 2010 at 3:07pm<br /><br />My solution assumed you did not want the expand button, so you would never see the blank popup.&nbsp; So do you want this button or not?&nbsp; Sounds like you need to hide the button for the toolbar and use my code, then it will have only not viewable buttons when popup appears.<br><br>So <font face="Courier New, Courier, mono">ShowExpandButton(FALSE) </font>should be False, then use my code and you have what you were looking for.&nbsp; <br><br>Add this line in Visual Studio GUI sample and you will see streched toolbar:<br><br>&nbsp;&nbsp;&nbsp; CXTPToolBar* pThemeBar = (CXTPToolBar*)pCommandBars-&gt;Add(_T("Theme"), xtpBarTop);<br>&nbsp;&nbsp;&nbsp; if (!pThemeBar ||<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; !pThemeBar-&gt;LoadToolBar(IDR_TOOLBAR_THEME))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRACE0("Failed to create toolbar\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; pThemeBar-&gt;EnableDocking(xtpFlagStretchedShared); //&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; This line<br><br><br>]]>
   </description>
   <pubDate>Tue, 08 Jun 2010 15:07:27 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58842&amp;title=how-to-create-a-fixed-toolbar#58842</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar :  Hello Mario  Thanks for you...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58816&amp;title=how-to-create-a-fixed-toolbar#58816</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6154">elmue</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 07 June 2010 at 11:59pm<br /><br />Hello Mario<br><br>Thanks for you help.<br><br>In your code pCommandList-&gt;FindControl(..) returns 0.<br><br>Instead of <br><font face="Courier New, Courier, mono">FindControl(xtpControlButton,.....</font><br>it must be<br><font face="Courier New, Courier, mono">FindControl(xtpControlPopup,.....</font><br><br>This will successfully remove the menu entry "Add or remove buttons".<br><br>But the result is a little strange: An empty menu opens when all icons fit into the toolbar.<br><br><img src="uploads/20100608_000224_CrippleMenu.gif" height="111" width="243" border="0"><br><br>It would be better if nothing would open at all or even better:<br>if the little arrow button would not appear in the toolbar when all icons fit into the toolbar.<br><br>________________<br><br>Your second suggestion doesn't work:<br><br>I tried to set the flag xtpFlagStretched with<br><font face="Courier New, Courier, mono">pMainToolBar-&gt;SetFlags(...)</font><br>and with<br><font face="Courier New, Courier, mono">pMainToolBar-&gt;EnableDocking(...)</font> <br>as described in the CommandReference.<br>Both have no effect.<br><br>Elmü<br><br><br>]]>
   </description>
   <pubDate>Mon, 07 Jun 2010 23:59:45 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58816&amp;title=how-to-create-a-fixed-toolbar#58816</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar :   You need something like this...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58812&amp;title=how-to-create-a-fixed-toolbar#58812</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 07 June 2010 at 2:41pm<br /><br />You need something like this for MFC version (untested code)<br><br>BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)<br>...<br>&nbsp;&nbsp;&nbsp; ON_XTP_INITCOMMANDSPOPUP()<br>...<br>END_MESSAGE_MAP()<br>...<br>afx_msg void OnInitCommandsPopup(CXTPPopupBar* pComandBar);<br>...<br>void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pCommandBar)<br>{<br>&nbsp;&nbsp;&nbsp; // get the list of commands for the popup.<br>&nbsp;&nbsp;&nbsp; CXTPControls* pCommandList = pCommandBar-&gt;GetControls();<br><br>&nbsp;&nbsp;&nbsp; // Remove "Add\Remove" menu item from the File menu.<br>&nbsp;&nbsp;&nbsp; CXTPControl* pCommandNew = pCommandList-&gt;FindControl(<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; xtpControlPopup, XTP_ID_CUSTOMIZE_ADDORREMOVE, TRUE, FALSE);<br>&nbsp;&nbsp;&nbsp; if (pCommandNew)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pCommandList-&gt;Remove(pCommandNew);<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>FYI, for #2 you just need xtpFlagStretched or xtpFlagStretchedShared<br>]]>
   </description>
   <pubDate>Mon, 07 Jun 2010 14:41:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58812&amp;title=how-to-create-a-fixed-toolbar#58812</guid>
  </item> 
  <item>
   <title><![CDATA[How to create a fixed toolbar :        HelloI wanted to...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58803&amp;title=how-to-create-a-fixed-toolbar#58803</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6154">elmue</a><br /><strong>Subject:</strong> 16791<br /><strong>Posted:</strong> 05 June 2010 at 8:13pm<br /><br />Hello<br><br>I wanted to create a toolbar that is neither movable, nor floatable nor closeable by the user.<br>I used the sample "GUI_VisualStudio".<br><br>What I wanted was a toolbar like this:<br><br><img src="uploads/20100605_194910_FixToolbar.gif" height="115" width="356" border="0"><br><br>To achieve that remove all the code from CMainFrame::OnCreate() that contains pCommandBar.<br><br><br><br>Insert this code into the header file MainFrm.h:<br><br>&nbsp;&nbsp;&nbsp; <font face="Courier New, Courier, mono">CXTPToolBar* mp_MainToolBar;<br></font><br><br><br>Insert this code into the file MainFrm.cpp:<br><br><font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; CXTPCommandBars* pCommandBars = GetCommandBars();<br><br>&nbsp;&nbsp;&nbsp; mpMainToolBar = (CXTPToolBar*)pCommandBars-&gt;Add(_T("Standard"), xtpBarTop);<br>&nbsp;&nbsp;&nbsp; if (!mp_MainToolBar || !mp_MainToolBar-&gt;LoadToolBar(IDR_MAINFRAME))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br><br>&nbsp;&nbsp;&nbsp; // disallow floating<br>&nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;SetFlags(0, xtpFlagFloating|xtpFlagAlignTop|xtpFlagAlignLeft|xtpFlagAlignRight|xtpFlagAlignBottom);<br><br>&nbsp;&nbsp;&nbsp; // remove the menu that appears when right clicking the toolbar<br>&nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;SetContextMenuPresent(FALSE);<br><br>&nbsp;&nbsp;&nbsp; // avoid that the toolbar can be closed<br>&nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;SetCloseable(FALSE);<br><br>&nbsp;&nbsp;&nbsp; // remove gripper at the left side<br>&nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;SetShowGripper(FALSE);<br><br>&nbsp;&nbsp;&nbsp; // remove the drop down menu at the right side<br>&nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;ShowExpandButton(FALSE);<br><br>&nbsp;&nbsp;&nbsp; // if you like the text below the icon instead of a tooltip (optional)<br>//&nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;ShowTextBelowIcons(TRUE);<br></font><br><br>That's it !<br><br>2.)<br><br>If you want additionally that the toolbar has 100% width of the window, add this to the header file:<br><br><font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; //{{AFX_VIRTUAL(CMainFrame)<br>&nbsp;&nbsp;&nbsp; .......<br>&nbsp;&nbsp;&nbsp; virtual void RecalcLayout(BOOL bNotify);<br>&nbsp;&nbsp;&nbsp; //}}AFX_VIRTUAL&nbsp;&nbsp;</font>&nbsp; <br><br><br>And this to the CPP file:<br><br><font face="Courier New, Courier, mono">CMainFrame::CMainFrame()<br>{<br>&nbsp;&nbsp;&nbsp; mp_MainToolBar = 0;<br>&nbsp;&nbsp;&nbsp; .......<br>}<br></font><br><font face="Courier New, Courier, mono">void CMainFrame::RecalcLayout(BOOL bNotify)<br>{<br>&nbsp;&nbsp;&nbsp; CXTPMDIFrameWnd::RecalcLayout(bNotify);<br><br>&nbsp;&nbsp;&nbsp; if (mp_MainToolBar &amp;&amp; mp_MainToolBar-&gt;GetSafeHwnd())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CRect k_Wnd;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GetClientRect(&amp;k_Wnd);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CRect k_Bar;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;GetClientRect(&amp;k_Bar);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;MoveWindow(0, 0, k_Wnd.Width()-2, k_Bar.Height());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mp_MainToolBar-&gt;Invalidate(FALSE);<br>&nbsp;&nbsp;&nbsp; }<br>}<br></font><br><br><br>3.)<br>Up to now I'm still searching without success how to remove ONLY the menu "Add or remove buttons" <br>WITHOUT removing the entire menu at the right side that appears when not all icons fit into the toolbar.<br><br><br><img src="uploads/20100605_195647_RemoveMenu.gif" height="176" width="361" border="0"><br><br><br><br><br>P.S.<br>I solved it partially, but after an entire day I still don't have what I wanted.<br><br>I hope that in the future there will be a tutorial available that is like mine here and explains how to do things like these!<br>This tutorial must explain the main features !with screenshots! - !NOT ONLY TEXT! and explain how to use this huge toolkit.<br><br>Elmü<br><br>]]>
   </description>
   <pubDate>Sat, 05 Jun 2010 20:13:18 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16791&amp;PID=58803&amp;title=how-to-create-a-fixed-toolbar#58803</guid>
  </item> 
 </channel>
</rss>