1

I'm trying to a add a new menu drop down to the ArcCatalog menu bar. I tried to use the built in ArcGIS base menu template in Visual Studios 2010 but no luck. I also tried to manually add the dll create with the base menu template in the custom dialog box but my menu does or menu items do not appear in the list.

I think my best approach is to use the IExtension but all the example I see online is using ArcMap. The examples retrieve the main menu by getting it from a new or open document using the "IApplication...CommandBar.Find" but I don't think there's a "document" in ArcCatalog?

I tried the following with no luck. I assume the document return from the IApplication is a GxDocument. I might be wrong.

    public void Startup(ref object initializationData)
    {
        ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
        ICommandBar topMenu = null;
        UID topMenuUid = new UIDClass();
        object index = null;
        ICommandBars commandBars = null;
        IDocument document = null;

        if (initializationData is IGxApplication)
        {
            m_application = (IApplication)initializationData;
            topMenuUid.Value = ARCCATALOG_MAIN_MENU_UID;
            document = m_application.Document;
            ICommandBars commandBars = document.CommandBars;
         }
    }
1

There is a document in ArcCatalog as well, a single one which exists through the whole application run. See GxDocument. You can manipulate command bars the same way.

  • Hi. I added code to my comment with your suggestion. Could you see if I'm doing something wrong. The method Startup(..) is a member of the IExtension class. Thanks. – Davidst95 Jan 9 '14 at 12:05
  • First, drop the RuntimeManager.Bind call, it's intended for standalone applications. Second, modifications to the UI should be done after the application is initialized - see IApplicationStatusEvents as well as the "Calling during startup" section in the ICommandBars.Find docs. – Petr Krebs Jan 9 '14 at 12:28

Your Answer

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

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