3

I have this code to know if a toolbar is displaying:

IApplication m_aplication = ArcMap.Application;

ICommandBar versionToolbar = GetToolbarByName(m_aplication, "esriArcMapUI.VersionToolbar");

if (versionToolbar.IsVisible()){
    versionToolbar.Dock(esriDockFlags.esriDockHide);
}

I can hide a toolbar, but I need to know when a toolbar is added to the desktop view, for example when the user check a toolbar in customize option:

enter image description here

I have this extension class:

public sealed class eManager : ESRI.ArcGIS.Desktop.AddIns.Extension
    {
       protected override void OnStartup()
       {
            MessageBox.Show("on Start up eManager");
       }
    }

And this config extension: enter image description here

but the event doesn't work

1 Answer 1

1

The status of the toolbar you can only check if your toolbar is part of an extension. There is a bit more work to implement. In Add Item-dialog in your Visual-Studio project you can choose the template Application Extension (Desktop) of Extending ArcObjects category.

4
  • Hi, I edited my question adding my extension class, and configuration. I put a message on start up, but it isn't showing.
    – Pilgrim
    Commented May 8, 2017 at 14:20
  • don't use ESRI.ArcGIS.Desktop.AddIns.Extension, I meant ESRI.ArcGIS.esriSystem.IExtension, so you can implement the IExtensionConfig Interface and use from there the State-Member. Commented May 15, 2017 at 8:38
  • look here for the State-Member Commented May 15, 2017 at 8:52
  • Thanks, I made a timer. But when a I have to change it, I gonna try with a IExtension class, and if works, I'll check your answer. Regards
    – Pilgrim
    Commented May 15, 2017 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.