I’m trying to create an add-in for ArcMap in Visual Studio that adds points on mouse clicks and then executes some geoprocessing on those points when the enter key is pressed.
So far sifting through the ArcObjects help has yielded a few things that I’ve tried unsuccessfully to put together:
- http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001v000000pq000000
- http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/OnMouseDown_Method/001v000000w1000000/
I’m wondering if it’s even possible to have more than one of these “events” activated by a tool or if I’m barking up the wrong tree and should be attempting a different method?
Here is a skeleton of some code I have so far:
namespace MultiEventTest
{
public class Tool1 : ESRI.ArcGIS.Desktop.AddIns.Tool
{
public Tool1()
{
}
protected override void OnUpdate()
{
Enabled = ArcMap.Application != null;
}
protected override void OnMouseDown(MouseEventArgs arg)
{
//code to add points to feature class
}
protected override void OnKeyDown(KeyEventArgs arg)
{
if (arg.ModifierKeys == (System.Windows.Forms.Keys.Enter))
{
//code to execute geoprocessing
}
}
}
}