Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a seemingly simple requirement that is causing me all types of headaches - listening for a map click event in ArcMap via ArcObjects. Simple as that, just tell me when the map is clicked (and x,y location obviously).

After some research, it appears that creating a custom tool that implements ITool was the way to go. Well it turns out that approach gets ugly due to some 'bugs' in ArcGIS Desktop (v10 at least). I don't want to add my custom tool to a toolbar, as it doesn't do anything and is irrelevant for a traditional ArcMap user. So, I thought I would just create a 'hidden' toolbar containing my custom tool. Well it turns out hiding a toolbar doesn't work so well (see this link).

The only other thing I can think of to do is add my custom tool to a 'standard' toolbar. The problem with this approach is that if the user then hides or removes whatever standard toolbar I put the custom tool in from ArcMap, the tool is no longer accessible.

Can someone please tell me that I am missing some very easy way to listen for a map click event without all the aforementioned complications?

share|improve this question
    
If you want to listen out for map events in arcmap I think the way to do it is to create an extension and use that to get a handle on the events. –  Hornbydd Apr 15 '12 at 22:44
    
Did you get a solution to your problem? –  ujjwalesri Jun 6 at 7:33

1 Answer 1

For me in 9.3.1, this is working. Registering to the appropriate event...

((ESRI.ArcGIS.Controls.AxMapControl)PlanetBase.MapControlComponent).OnMouseDown += new ESRI.ArcGIS.Controls.IMapControlEvents2_Ax_OnMouseDownEventHandler(Class1_OnMouseDown);

...and going on with...

void Class1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
    {
        //...
    }

I just checked, it works in ESRI 10 also...

share|improve this answer
    
Looks like your code is for ArcEngine; I am looking for ArcMap equivalent. –  user890 Mar 25 '12 at 15:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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