diana31

How Determine what kind of item has been clicked on MapControl???

Discussion created by diana31 on May 25, 2011
Hi everybody! I hope you can help me, I am using ArcGis Engine and Java. I want to know How can I determine what kind of item has been clicked on MapControl??? Or in the case, how can I get the item or object in the MapControl with the X, Y coordinates that I get with the PopupMenu.

In TOCControl I can determine what kind of item has been clicked on with this:
axTOCControl.hitTest(theEvent.getX(), theEvent.getY(), item, map, layer, other, index);
    
//Only respond to clicks for layer items
if (item[0] == esriTOCControlItem.esriTOCControlItemLayer && layer != null)
{ ...
}


But working with MapControl, it does not have this method (hitTest).

This is how I set the context menu:
contextMenu.popupMenu(theEvent.getX(), theEvent.getY(), axMapControl1.getHWnd());


I want to know this because I wanto to show a specific context menu if the user clicked on an annotation.

I really appreciate your help :)

Outcomes