Need to add event handler for onClick in ArcMap

539
2
10-31-2013 10:08 AM
StevenMumby
New Contributor
Hi guys

I have a custom command button I've added to ArcMap.  When clicked, it opens a new winForm window.  Now I need to get a reference for the arcMap's open document or layer (sorry - total newbie, so excuse the poor lingo).  How is this possible?  From a sample tutorial I've found so far, I see I can pass in a reference from ArcMap of type IApplication to my winForm, but don't think this has what I need to listen for mouse click events on the ArcMap object.

Tks
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
If you need for the user to interact with the map then you should be creating a tool, not a command.  The implementation of a tool includes mouse down, mouse up and mouse move events.
0 Kudos
StevenMumby
New Contributor
Tks.  I'm probably getting the lingo wrong. Here's what I've accomplished so far and am trying to do:

1. Created custom menu options as follows:

public sealed class CoWAddressPointMenu : BaseMenu, ESRI.ArcGIS.Framework.IRootLevelMenu
{
        public CoWAddressPointMenu()
        {
            AddItem("CoW.GIS.AddressPointTool.AddAddressPointCommand", 1);
            AddItem("CoW.GIS.AddressPointTool.EditAddressPointCommand", 2);
        }
}

2.  Open a winForm when either of the above options are clicked.  I pass in a reference of IApplication from ArcMap to the new winForm.  This exposes a couple of properties I suspect may be useful like IDocument.  This winForm has a couple of textboxes that the user needs to complete.  Some of the textbox values will be populated by the user clicking on the open ArcMap document, retrieving attributes like the street segment and parcel ID.

I'm a web developer taking my first stab at customizing ArcGIS so may be on the wrong path.  Any suggestions?
0 Kudos