<?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: how to get the pushbutton which i click in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3857851#M79608</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the TBC blog, you can find this posting:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://thebuildingcoder.typepad.com/blog/2011/02/pimp-my-autocad-or-revit-ribbon.html"&gt;http://thebuildingcoder.typepad.com/blog/2011/02/pimp-my-autocad-or-revit-ribbon.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you scroll downwards, there is this:&lt;/P&gt;&lt;P&gt;Also, an event listener can be achieved for both CAD systems:&lt;/P&gt;&lt;P&gt;ComponentManager.UIElementActivated&lt;/P&gt;&lt;P&gt;&amp;nbsp; += new EventHandler&amp;lt;Autodesk.Windows&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; .UIElementActivatedEventArgs&amp;gt;(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ComponentManager_UIElementActivated );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void ComponentManager_UIElementActivated(&lt;/P&gt;&lt;P&gt;&amp;nbsp; object sender,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Autodesk.Windows.UIElementActivatedEventArgs e )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; // e.UiElement.PersistId says which item has been pressed&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way, you may be notified which button is clicked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2013 11:21:07 GMT</pubDate>
    <dc:creator>Revitalizer</dc:creator>
    <dc:date>2013-04-12T11:21:07Z</dc:date>
    <item>
      <title>how to get the pushbutton which i click</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3842998#M79606</link>
      <description>&lt;PRE&gt;//创建Panle
private void CreateRibbonPanel(UIControlledApplication application) 
{
    string tabName = "测绘院工具集";
    string panelName = "测绘院";
    string panelHelperName = "帮助信息";

    application.CreateRibbonTab(tabName);

    #region 孔洞插件

    RibbonPanel panelHole = application.CreateRibbonPanel(tabName, panelName);
    panelHole.Title = "孔洞插件";

    //自动开洞
    PushButtonData btnData1 = new PushButtonData(Properties.Resources.AutoHoleButtonName, Properties.Resources.AutoHoleButtonTitle, AddInPath, "NBGisRevit.NBGisOpeningInWallCommand");
    PushButton button1 = panelHole.AddItem(btnData1) as PushButton;
    button1.ToolTip = "自动开洞";
    button1.LongDescription = "自动开洞";
    button1.LargeImage = CommFunction.GetEmbeddedImage("NBGisRevit.Resources.Icons.qzdkd.png", ImageType.Png);
    
    #endregion
}

[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class NBGisOpeningMonitorCommand : IExternalCommand
{
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        try
        {
            //How to get the PushButton i clicked here?

            return Result.Succeeded;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
            return Result.Failed;
        }            
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;About is the code , i want to get the button i clicked in the Excute Function,because i want to change the text of the button,so how can i do this?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2013 08:51:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3842998#M79606</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-10T08:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the pushbutton which i click</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3848910#M79607</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that's not directly possible...at least I couldn't figure out any way. But you could store those button objects somewhere in your application object. Furthermore you could then access / set the text for these buttons via properties/functions of the application class. You just need to figure out some convenient way how to get the instance of the application class within your command class.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 05:21:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3848910#M79607</guid>
      <dc:creator>ollikat</dc:creator>
      <dc:date>2013-04-11T05:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the pushbutton which i click</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3857851#M79608</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the TBC blog, you can find this posting:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://thebuildingcoder.typepad.com/blog/2011/02/pimp-my-autocad-or-revit-ribbon.html"&gt;http://thebuildingcoder.typepad.com/blog/2011/02/pimp-my-autocad-or-revit-ribbon.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you scroll downwards, there is this:&lt;/P&gt;&lt;P&gt;Also, an event listener can be achieved for both CAD systems:&lt;/P&gt;&lt;P&gt;ComponentManager.UIElementActivated&lt;/P&gt;&lt;P&gt;&amp;nbsp; += new EventHandler&amp;lt;Autodesk.Windows&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; .UIElementActivatedEventArgs&amp;gt;(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ComponentManager_UIElementActivated );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void ComponentManager_UIElementActivated(&lt;/P&gt;&lt;P&gt;&amp;nbsp; object sender,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Autodesk.Windows.UIElementActivatedEventArgs e )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; // e.UiElement.PersistId says which item has been pressed&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way, you may be notified which button is clicked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 11:21:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-pushbutton-which-i-click/m-p/3857851#M79608</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2013-04-12T11:21:07Z</dc:date>
    </item>
  </channel>
</rss>

