<?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: ICommandItem.Refresh does not reread ICommand Caption (version 10) in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106725#M2797</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would you be able to post your code as an example of how to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Aug 2011 14:36:48 GMT</pubDate>
    <dc:creator>DavidStajan</dc:creator>
    <dc:date>2011-08-26T14:36:48Z</dc:date>
    <item>
      <title>ICommandItem.Refresh does not reread ICommand Caption (version 10)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106719#M2791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am migrating an ArcMap 9.3 extension to version 10.&amp;nbsp; After a particular user action I am changing the caption value for an ICommand instance.&amp;nbsp; In previous versions of ArcObjects this change would be shown to the user immediately.&amp;nbsp; In version 10 the change to the command's caption does not result in any repaint of the gui.&amp;nbsp; To fix this I am calling the Refresh method of the ICommandItem object which holds the ICommand.&amp;nbsp; The API states that calling Refresh will cause "the command item to be redrawn on the CommandBar in order to correctly display any new property changes."&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there something I'm missing?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 15:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106719#M2791</guid>
      <dc:creator>RobinCarnow</dc:creator>
      <dc:date>2011-08-15T15:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandItem.Refresh does not reread ICommand Caption (version 10)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106720#M2792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;After changing the ICommand's caption, I was able to get ArcGIS to reread the new Caption value by calling the Reset method on ICommandItem.&amp;nbsp; But for some reason this still does not change the visible text on the button. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any idea how to get this to work?&amp;nbsp; I'm not sure why this is so hard to do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Aug 2011 23:09:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106720#M2792</guid>
      <dc:creator>RobinCarnow</dc:creator>
      <dc:date>2011-08-16T23:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandItem.Refresh does not reread ICommand Caption (version 10 on Windows 7)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106721#M2793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am Bumping this thread since I have tried to call Refresh and Reset on the ICommandItem that contains the ICommand whose caption has been changed.&amp;nbsp; Neither method will update the gui to the newly set value of the caption (i.e. a call to ICommand.Caption returns a different value).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone had any experience with changing the caption of a command dynamically based on user actions on other commands (e.g. mouse click)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Robin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Aug 2011 17:26:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106721#M2793</guid>
      <dc:creator>RobinCarnow</dc:creator>
      <dc:date>2011-08-17T17:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandItem.Refresh does not reread ICommand Caption (version 10)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106722#M2794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe is it not meant to be changed it has only get property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/esrisystemui/ICommand_Caption.htm"&gt;http://resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/esrisystemui/ICommand_Caption.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But i have solution for you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Create window form ToolbarControls and create on it standard Label control&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[System.Runtime.InteropServices.ComVisible(true)]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public partial class ToolbarControls : Form&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Create static class that will hold {get; set;} public static reference to the Form ToolbarControls with label&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public static class HwndHolder&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{[INDENT]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static ToolbarControls _ToolbarControls = null;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static Forms.ToolbarControls ToolbarControls&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {[INDENT]&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;&amp;nbsp;&amp;nbsp; get{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _ToolbarControls;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _ToolbarControls = value;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;create Command with the IToolControl sou you can use hwnd attribute&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public class cmd_Label : IToolControl, ICommand&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{[INDENT]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int hWnd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {[INDENT]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ToolbarControls.Label_Control.Handle.ToInt32();&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/INDENT]}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add control to the toolbar in the IToolBarDef.GetItemInfo with index and item GUID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If GUID not expicit defined it will be Namespace.ClassName if in root of solution and if in folder then Namespace.FolderInSolution.ClassName.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried Label.onClick and it works by changing text each time i click&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Happy coding&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2011 08:53:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106722#M2794</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2011-08-19T08:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandItem.Refresh does not reread ICommand Caption (version 10)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106723#M2795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just saw that I misses one key point here that is I wrote and tested it in v.9.3.1 and you are trying that in v.10. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry but at the moment I'm unable to run the test at ArcGis 10 to prove does it work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2011 18:10:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106723#M2795</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2011-08-19T18:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandItem.Refresh does not reread ICommand Caption (version 10)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106724#M2796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks you very much Dubravko.&amp;nbsp; I was able to get this working from the notes you provided.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I ended up going with two classes since I did not need a complete form, only a tool I can add to my BaseToolbar:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//first class is a Label class containing all of the event handlers I used to have in my ICommand class&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//second class is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public sealed class ControlAdapter : BaseTool, IToolControl{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static Label myLabel;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public override void OnCreate(object hook){ //init label here }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int hWnd { get { return myLabel.Handle.ToInt32(); } }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //all of the events I wanted to handle which are passed to myLabel&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically all I needed was an adapter class to have ArcObjects use a simple windows control.&amp;nbsp; Thank you very much for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2011 13:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106724#M2796</guid>
      <dc:creator>RobinCarnow</dc:creator>
      <dc:date>2011-08-22T13:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: ICommandItem.Refresh does not reread ICommand Caption (version 10)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106725#M2797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would you be able to post your code as an example of how to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2011 14:36:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/icommanditem-refresh-does-not-reread-icommand/m-p/106725#M2797</guid>
      <dc:creator>DavidStajan</dc:creator>
      <dc:date>2011-08-26T14:36:48Z</dc:date>
    </item>
  </channel>
</rss>

