1

I added a new custom tree to TOC which looks like this:

IObjectClass
    IFeature
    IFeature ...
IObjectClass
    IRow ...

made context menu using this sample http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000026q000000 and it shows up alright, but unfortunatelly its context menu commands are not doing anything. Here is onNodeMouseClick:

private void tvwSelected_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
    if (e.Button == MouseButtons.Right)
    {
        m_contextItem = e.Node.Tag;

        UID menuID = new UIDClass();
        if (e.Node.Tag is IFeature)
            menuID.Value = "{d32ae970-abb8-4f02-a592-9181f1307ed9}";
        else
            return;
        ICommandBar cmdBar = (ICommandBar)_application.Document.CommandBars.Find(menuID, false, false);
        cmdBar.Popup(0, 0);
    }
}

and here is context menu:

public ContextMenuTest()
{
    AddItem("esriCore.FeatureFindContextMenuItems", 1); //flash
    AddItem("esriCore.FeatureFindContextMenuItems", 2); //zoom
    AddItem("esriCore.FeatureFindContextMenuItems", 3); //identify
    AddItem("esriCore.FeatureFindContextMenuItems", 6); //unselect
}

I believe the probblem could be that IFeature is not what these commands require, or the whole thing works in totaly different way. Any help would be appreciated.

  • "added a custom tree" ... does that mean you've implemented a custom IContentsView? – Kirk Kuykendall Mar 25 '13 at 14:50
  • @Kirk Kuykendall Yes, I did implement IContentsView3 just like in that sample given above. – Sunder Mar 25 '13 at 22:59
  • Anything Esri wrote with "esriCore" in the progid was deprecated way back in version 8.3. In your context menu you need to return progID's of commands you have written that expect IContentsView.CurrentItem to be an IObjectClass or an IFeature. – Kirk Kuykendall Mar 25 '13 at 23:12

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.