Creating an Add-in Tool

963
4
Jump to solution
07-12-2012 08:35 AM
USFS_AGOLAdministrator
New Contributor III
Hello all,

I recently developed a custom Add-in button in ArcMap using vb.net, and thought it would be easy to create an add-in Tool the same way.  However, when I go through the steps to create an add-in Tool, the plumbing code for OnMouseDown and OnMouseUp is not there.  Here's the steps I'm taking to create my project, using VS 2008 with vb.net:

1. File - New Project.
2. Visual Basic > ArcGIS > Desktop Add-Ins > ArcMap Add-in.
3. Fill in Add-in name, etc.
4. Check the tool option to specify this add-in is supposed to be a tool.

In the Tool1.vb code, the only thing that shows up is Public Sub New(), and Protected Overrides Sub onUpdate.  There is no onMouseDown or OnMouseUp.  I can create a form, and create a tool on the form, and the tool on the form will have onMouseDown and onMouseUP, but is there not a way to get an Add-in tool to operate directly from a toolbar?
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
The Intellisense choices show up as you start typing Protected and Overrides with different options as you select them. In fact, you don't even need to type in Sub...that will get added automatically when selecting such arguments as OnMouseDown. My screen capture program just doesn't catch the Intellisense context menu.

View solution in original post

0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor
You're almost there. What you'll have to do is start typing in

Protected Overrides Sub

and you'll see the OnMouseDown, OnMouseUp, and other arguments show up in Intellisense. Select one and the rest of the sub is added.
[ATTACH=CONFIG]16027[/ATTACH][ATTACH=CONFIG]16028[/ATTACH]
0 Kudos
LeoDonahue
Occasional Contributor III
Ken,

Does Visual Studio have something like a context menu that lets you choose to override/implement methods?  Ecplise does that and saves alot of typing for me.
0 Kudos
KenBuja
MVP Esteemed Contributor
The Intellisense choices show up as you start typing Protected and Overrides with different options as you select them. In fact, you don't even need to type in Sub...that will get added automatically when selecting such arguments as OnMouseDown. My screen capture program just doesn't catch the Intellisense context menu.
0 Kudos
USFS_AGOLAdministrator
New Contributor III
Thanks Ken,

That did the trick.  Good thing they have this documented so well, hu.
0 Kudos