<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ICommandBar vs. IToolBarDef in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157731#M4148</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am migrating .NET, C# code for custom extension from version 9.3 to 10.1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is creating many toolbars on the fly and add commands to them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code snippets for creating one toolbar is like follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBars bars = m_application.Document.CommandBars;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBar newBar = bars.Create("my new toolbar",&amp;nbsp; esriCmdBarType.esriCmdBarTypeToolbar);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID uid = new UIDClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uid.Value = "{E1F29C6B-4E6B-11D2-AE2C-080009EC732A}";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; object index = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newBar.Add(uid, ref index);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newBar.Dock(dockstyle, referencetoolbar);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so the above code works fine for 9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I recompile it on 10.1 , it produce an empty toolbar that has nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I investigate, and found out that the command "Dock" is corrupting the toolbar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, without Dock, the toolbar is created properly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am reading on ArcObjects, and the documentation of ICommandBars.Create, says that this will create VBA toolbar, and if you are using non VBA platform, then use IToolBarDef instead.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, is this command (ICommandBars.Create) is not supported with 10.1 and .NET?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Jan 2013 20:48:24 GMT</pubDate>
    <dc:creator>GhassanKarwchan</dc:creator>
    <dc:date>2013-01-31T20:48:24Z</dc:date>
    <item>
      <title>ICommandBar vs. IToolBarDef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157731#M4148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am migrating .NET, C# code for custom extension from version 9.3 to 10.1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is creating many toolbars on the fly and add commands to them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code snippets for creating one toolbar is like follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBars bars = m_application.Document.CommandBars;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBar newBar = bars.Create("my new toolbar",&amp;nbsp; esriCmdBarType.esriCmdBarTypeToolbar);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID uid = new UIDClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uid.Value = "{E1F29C6B-4E6B-11D2-AE2C-080009EC732A}";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; object index = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newBar.Add(uid, ref index);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newBar.Dock(dockstyle, referencetoolbar);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so the above code works fine for 9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I recompile it on 10.1 , it produce an empty toolbar that has nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I investigate, and found out that the command "Dock" is corrupting the toolbar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, without Dock, the toolbar is created properly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am reading on ArcObjects, and the documentation of ICommandBars.Create, says that this will create VBA toolbar, and if you are using non VBA platform, then use IToolBarDef instead.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, is this command (ICommandBars.Create) is not supported with 10.1 and .NET?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2013 20:48:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157731#M4148</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-01-31T20:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandBar vs. IToolBarDef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157732#M4149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't understand how no body at ESRI can answer my question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the support at ESRI Canada sucks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you don't know how to make a functional software then don't do it .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will repeat my question because it is so simple.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have this code that create toolbar on the fly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ICommandBars bars = m_application.Document.CommandBars;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ICommandBar newBar = bars.Create("my new toolbar", esriCmdBarType.esriCmdBarTypeToolbar);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newBar.Add("{.....}");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newBar.Dock(dockstyle, referencetoolbar);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code works fine on 9.3, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But on 10.1 , the dock statement at the end is causing the toolbar to be empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Without the dock statement, the toolbar is created properly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't tell me that no one at ESRI can answer that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Seriously&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2013 14:57:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157732#M4149</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-02-05T14:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandBar vs. IToolBarDef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157733#M4150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The following code works for me in 10.1 as a C# add-in button.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void OnClick()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBars bars = ArcMap.Application.Document.CommandBars;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBar newBar = bars.Create("my new toolbar", esriCmdBarType.esriCmdBarTypeToolbar);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID uid = new UIDClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uid.Value = "{E1F29C6B-4E6B-11D2-AE2C-080009EC732A}";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object index = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newBar.Add(uid, ref index);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //find the standard toolbar and bang it on the end
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID barID = new UIDClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; barID.Value = "esriArcMapUI.StandardToolBar";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ICommandBar stb = bars.Find(barID, false, false) as ICommandBar;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newBar.Dock(esriDockFlags.esriDockRight,stb);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:21:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157733#M4150</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T08:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandBar vs. IToolBarDef</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157734#M4151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I reviewed the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually the order of the code is important, which is weird &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I put the Dock statement before adding command buttons to the toolbar, it empty the toolbar for some reason.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I moved the dock after, and it worked fine&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And the funny thing that the 9.3 works fine with Dock before adding items.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something stupid going on.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2013 19:33:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommandbar-vs-itoolbardef/m-p/157734#M4151</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-02-05T19:33:48Z</dc:date>
    </item>
  </channel>
</rss>

