<?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 : Docking a toolbar at specified position</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Docking a toolbar at specified position]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 18 Jun 2026 07:45:45 +0000</pubDate>
  <lastBuildDate>Fri, 08 May 2020 15:17: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=23979</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[Docking a toolbar at specified position : By the way, since I call SaveCommandBars...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77674&amp;title=docking-a-toolbar-at-specified-position#77674</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 23979<br /><strong>Posted:</strong> 08 May 2020 at 3:17pm<br /><br />By the way, since I call SaveCommandBars on exit and LoadCommandbars on launch, I didn't have to do anything special to detect a "first" startup. I simply dock the bar and then call LoadCommandBars. So, if I start clean and set to the middle and move the bar, I can exit and restart and it resets the pos to where I moved it to before the last exit.<br>]]>
   </description>
   <pubDate>Fri, 08 May 2020 15:17:36 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77674&amp;title=docking-a-toolbar-at-specified-position#77674</guid>
  </item> 
  <item>
   <title><![CDATA[Docking a toolbar at specified position : Hi dbrookes. With all the CJ stuff,...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77673&amp;title=docking-a-toolbar-at-specified-position#77673</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 23979<br /><strong>Posted:</strong> 08 May 2020 at 2:52pm<br /><br /><div>Hi dbrookes. With all the CJ stuff, I didn't even think about the MFC style docking calls.</div><div><br></div><div>CJ uses the ScreenToClient API when docking so I used your code with a bit of modification. I got the client rect of the app and called ClientToScreen on it. I also then added the .left member of the result to the left and right calculations.<br></div>]]>
   </description>
   <pubDate>Fri, 08 May 2020 14:52:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77673&amp;title=docking-a-toolbar-at-specified-position#77673</guid>
  </item> 
  <item>
   <title><![CDATA[Docking a toolbar at specified position : Hi rdhd.We do a similar thing...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77671&amp;title=docking-a-toolbar-at-specified-position#77671</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9372">dbrookes</a><br /><strong>Subject:</strong> 23979<br /><strong>Posted:</strong> 03 May 2020 at 8:43pm<br /><br /><div>Hi rdhd.</div><div><br></div><div>We do a similar thing in our application by providing a default layout which provide a base for a user-specific layout. I think the MRUDockLeftPos key is used to offset the toolbar.</div><div><br></div><div>An alternative would be to do it programmatically, which may be better. At least this way you could account for different frame widths and DPI scaling.<br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>&nbsp;&nbsp;&nbsp; const CXTPClientRect rcClient(this);<br>&nbsp;&nbsp;&nbsp; const CXTPWindowRect rcToolBar(pToolBar);<br>&nbsp;&nbsp;&nbsp; CRect rcDock{ rcToolBar };<br>&nbsp;&nbsp;&nbsp; rcDock.left = rcClient.Width()/2 - rcToolBar.Width()/2;<br>&nbsp;&nbsp;&nbsp; rcDock.right = rcClient.Width()/2 + rcToolBar.Width()/2;<br>&nbsp;&nbsp;&nbsp; pCommandBars-&gt;DockCommandBar(pToolBar, rcDock, pToolBar-&gt;GetDockBar());<br></div><div></pre></td></tr></table></div><div>I guess you would need to find a way to not do this on every startup :)</div>]]>
   </description>
   <pubDate>Sun, 03 May 2020 20:43:37 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77671&amp;title=docking-a-toolbar-at-specified-position#77671</guid>
  </item> 
  <item>
   <title><![CDATA[Docking a toolbar at specified position : We allow a single toolbar docked...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77670&amp;title=docking-a-toolbar-at-specified-position#77670</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 23979<br /><strong>Posted:</strong> 01 May 2020 at 4:42pm<br /><br /><div>We allow a single toolbar docked at the top of our app under the ribbon. We want the out-of-the-box position of the bar to be centered wrt the frame.</div><div><br></div><div>I found the toolbar GetToolbarInfo (and Set...) APIs. Even though they are public, they are useless since the returned structure is not public. I'm not sure if will even help if I had access to the structure. I have found when I save the command bars, CJ writes an "xPos" and other data into the registry for the bar.</div><div><br></div><div>So I thought perhaps I could "seed" the registry on the first run of the app and get the bar to move over. But, I have found that even if I manually edit the xPos value in the registry, the bar doesn't move. If I move it dynamically by dragging it and save the bar layout, that value changes. But, changing it manually has no effect. I have stepped thru the load bar layout code and see that toolbar info being seeded with it and even a SetWindowPos call being made with the point (and I see the xPos I set in the registry is used in that call). But when the bar displays, it stays where I last put it.</div><div><br></div><div>So it seems the reg entry isn't really used. Except that if I delete the entire hive for that bar ("Application-Bar1" for my bar), it goes back to the default pos at the left of the dockbar/app frame. But, just delete the xPos and yPos instead and CJ still places it as the position I moved it to before saving the bar layout.</div><div><br></div><div>Anyone have a suggestion of either how to influence the initial position (xPos is what I care about) or just where CJ is really getting the position from?<br></div>]]>
   </description>
   <pubDate>Fri, 01 May 2020 16:42:27 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23979&amp;PID=77670&amp;title=docking-a-toolbar-at-specified-position#77670</guid>
  </item> 
 </channel>
</rss>