<?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 Re: Determine which Command Item is selected on ArcMaps standard Command Bar in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478342#M12960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jamari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/0023/002300000037000000.htm"&gt;CurrentTool&lt;/A&gt; property off &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/0023/00230000002w000000.htm"&gt;IApplication &lt;/A&gt;what you're looking for?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Nov 2014 18:57:12 GMT</pubDate>
    <dc:creator>ErinBrimhall</dc:creator>
    <dc:date>2014-11-24T18:57:12Z</dc:date>
    <item>
      <title>Determine which Command Item is selected on ArcMaps standard Command Bar</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478341#M12959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with Add-Ins in ArcMap using VS2010 and C#. I have a question in regards to ArcObjects ICommandBar and ICommandItem classes. I've looked at these and have been able to produce code, that on button click, will select or activate a specified command item. So I know somethings about command bars. My question is how would I go about determining which command Item is active on a Command Bar? I didn't see any helpful methods in which to do so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not all too sure which to even use at this point, between the ICommandBars object or the ICommandBar object. I've also discovered (I think) that the value/ref for the standard tool bar is:&amp;nbsp;&amp;nbsp; "{5DEB1DB8-C2A9-11D1-B9A2-080009EE4E51}" .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this is correct. Also, when I say standard tool bar, I mean the one with the select element tool on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this would be greatly appreciated. Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 18:02:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478341#M12959</guid>
      <dc:creator>JamariPowers</dc:creator>
      <dc:date>2014-11-24T18:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Determine which Command Item is selected on ArcMaps standard Command Bar</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478342#M12960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jamari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/0023/002300000037000000.htm"&gt;CurrentTool&lt;/A&gt; property off &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/0023/00230000002w000000.htm"&gt;IApplication &lt;/A&gt;what you're looking for?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 18:57:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478342#M12960</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-11-24T18:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Determine which Command Item is selected on ArcMaps standard Command Bar</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478343#M12961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had briefly looked at this property but not too much. I was able to set a tool on the command bar (Make active or make it highlighted, or execute it) using the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;UID pUID =&amp;nbsp; new UID();
myUid.Value = "esriArcMapUI.SelectTool";
IDocument ThisDoc = ArcMap.Application.Document;
ICommandBars CommandBars = ThisDoc.CommandBars as ICommandBars;
CommandBars.Find(myUid);
ICommandItem myItem = CommandBars.Find(myUid) as ICommandItem;
myItem.Execute();&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would select the "Select Element" tool on, perhaps, a button click. I'd call it from a function that needs to always run, so every time my function ran, the "Select Element" tool would be ran. But I need to know the current tool first so maybe I can do a conditional on my code and only run it in certain cases (Kind of went on a tangent). Anyways, from the info you provided me with, I believe I can get the current tool and do a comparison and then set the tool I need. I hope that made sense. The main thing for my overall,overall problem is getting the currently selected tool. Hopefully I can accomplish this with the info you've provided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:08:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478343#M12961</guid>
      <dc:creator>JamariPowers</dc:creator>
      <dc:date>2021-12-11T21:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Determine which Command Item is selected on ArcMaps standard Command Bar</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478344#M12962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I finally found an answer to my problem. I was making this a little harder than it was and thinking about it way too hard. The code below can be used to return the currently selected tool in ArcMap (In my case I am returning the tooltip of the currently selected tool in my diagnostic window).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public static ICommandItem CurrentTool()
{
&amp;nbsp;&amp;nbsp; IApplication _myApp = ArcMap.Application;
&amp;nbsp;&amp;nbsp; string getToolTip = _myApp.CurrentTool.ToolTip;
&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.Write("Tool Tip is: " + getToolTip);
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; return _myApp.CurrentTool;
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I call this function on a button click. So, When I launch ArcMap, I select a tool from the toolbar. I look into my diagnostic window and I'm able to see the tool tip for the selected tool. I will need to tweak a few things for my own benefit, but this would be the answer I am looking for. Hope this can be of some help to any one else.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:08:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478344#M12962</guid>
      <dc:creator>JamariPowers</dc:creator>
      <dc:date>2021-12-11T21:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Determine which Command Item is selected on ArcMaps standard Command Bar</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478345#M12963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Short and sweet; I like it.&amp;nbsp; Glad you got this figured out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 22:45:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/determine-which-command-item-is-selected-on/m-p/478345#M12963</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-11-25T22:45:50Z</dc:date>
    </item>
  </channel>
</rss>

