<?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 Access Add-in Button.Caption in Code in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347928#M9201</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody tell me how to read the Caption, Message and Tooltip properties of an ArcMap Add-in Button programmatically? The properties are defined in the Config.esriaddinx file and are shown correctly in ArcMap. However, when I try to query them, say, in the Button's OnClick method, I only get an empty string:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class DummyButton : Button &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(string.Format("Button '{0}' was clicked!", this.Caption)); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the other hand, it is possible to change the properties Message and Tooltip programmatically, and the update is reflected both in ArcMap and in code. The Caption can be changed too and will be available in code, although in ArcMap the button's caption won't be updated. But how to get the values that are defined in the config file? Btw, I'm using ArcGIS for Desktop 10.2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any hints,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Fridjof&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jun 2014 08:14:17 GMT</pubDate>
    <dc:creator>FridjofSchmidt</dc:creator>
    <dc:date>2014-06-12T08:14:17Z</dc:date>
    <item>
      <title>Access Add-in Button.Caption in Code</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347928#M9201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody tell me how to read the Caption, Message and Tooltip properties of an ArcMap Add-in Button programmatically? The properties are defined in the Config.esriaddinx file and are shown correctly in ArcMap. However, when I try to query them, say, in the Button's OnClick method, I only get an empty string:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class DummyButton : Button &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(string.Format("Button '{0}' was clicked!", this.Caption)); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On the other hand, it is possible to change the properties Message and Tooltip programmatically, and the update is reflected both in ArcMap and in code. The Caption can be changed too and will be available in code, although in ArcMap the button's caption won't be updated. But how to get the values that are defined in the config file? Btw, I'm using ArcGIS for Desktop 10.2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any hints,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Fridjof&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 08:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347928#M9201</guid>
      <dc:creator>FridjofSchmidt</dc:creator>
      <dc:date>2014-06-12T08:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Access Add-in Button.Caption in Code</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347929#M9202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Fridjof,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to access and modify the "true" Caption, Tooltip, etc. of the button, you need to work with the ICommand object that is registered as part of your Add-In (as defined in its Config.esriaddinx).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can accomplish this by using the "ThisAddIn" class (an auto-generated helper class), and the "CommandBars" property of the current IDocument object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the code below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;ESRI.ArcGIS.esriSystem.UID uid = new ESRI.ArcGIS.esriSystem.UIDClass(); uid.Value = ThisAddIn.IDs.MyCustomButtom;&amp;nbsp; ESRI.ArcGIS.Framework.ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(uid); commandItem.Caption = "New Caption"; commandItem.Message = "New Message"; commandItem.Tooltip = "New Tooltip";&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Changing the properties on the ICommand will update the button in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 16:58:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347929#M9202</guid>
      <dc:creator>ErinBrimhall</dc:creator>
      <dc:date>2014-06-13T16:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Access Add-in Button.Caption in Code</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347930#M9203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Erin,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, that's what I was looking for!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 11:38:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/access-add-in-button-caption-in-code/m-p/347930#M9203</guid>
      <dc:creator>FridjofSchmidt</dc:creator>
      <dc:date>2014-06-16T11:38:55Z</dc:date>
    </item>
  </channel>
</rss>

