3

I am developing custom ArcMap toolbar with various AddIn tools, button and extension. I see the sample how to access the ActiveView events in the extension Initialize() method.

 private void Initialize()
    {
      // If the extension hasn't been started yet or it's been turned off, bail
      if (s_extension == null || this.State != ExtensionState.Enabled)
        return;

      // Reset event handlers
      IActiveViewEvents_Event avEvent = ArcMap.Document.FocusMap as IActiveViewEvents_Event;
      avEvent.ItemAdded += AvEvent_ItemAdded;
      avEvent.ItemDeleted += AvEvent_ItemAdded;
      avEvent.SelectionChanged += UpdateSelCountDockWin;
      avEvent.ContentsChanged += avEvent_ContentsChanged;
             ....
              // ? Possible to access AddIn button even here ?
              myCustomAddInToolbar.myCustomAddInButton.RaiseCustomEvent += HandleCustomEvent; 

How can I wire my custom AddIn Button? I don't know how to access the AddIn button events from here. Is there any ArcMap(ArcObjects) Interface to access AddIn Toolbar/Button Events? Thanks

  • Can you provide link to the sample? – Kirk Kuykendall Jun 19 '13 at 22:38
  • Building add-ins for ArcGIS for Desktop - Custom Selection Sample resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/… – mitaka Jun 20 '13 at 12:13
  • I added another AddIn button to the sample that processes the Feature Selection on the ArcMap. I want to display some data in the custom ArcMap Dock Window (SelCountDockWin) when the AddIn button is clicked. – mitaka Jun 20 '13 at 12:21
  • 3
    Usually it's the button's job to find the Extension and call methods on the Extension. Extensions usually shouldn't know about buttons. Have you tried having your button find the extension (or dockable window) and call a method on it? – Kirk Kuykendall Jun 20 '13 at 12:49
  • My bad. I had the impression that I have to set the event handlers in the extension. It worked the way you suggested. Thanks! – mitaka Jun 20 '13 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.