how to select the start for rubber band

644
3
09-02-2013 05:40 AM
PaulCole
New Contributor
I am trying to use the rubberband class.
Normally this would be done from a tool on the map, but due to the request this has to be from a menu option and not the tool bar options, When I then use
IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);

the first point is taken from where the menu was.
Is there someway to wait till the user clicks inside the map before starting the rubber band but without using the toolbar control.

Paul Cole
0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
If I'm understanding this right then what you're wanting to do is call a custom tool you've already written from a menu instead of a toolbar.  When a custom tool is on an ArcMap toolbar, ArcMap handles activating that tool for you when the button is clicked.  When you call it from a menu, then you have to handle the activation yourself.  If your custom tool is on a toolbar, then all you need to do is call IDocument.CommandBars.Find to get that instance of the tool and set it to be the current tool using IApplication.CurrentTool.  If your custom tool is not already on a toolbar then you will need to create a new instance of the tool class, call ICommand.OnCreate and then set it to be the current tool using IApplication.CurrentTool.
0 Kudos
PaulCole
New Contributor
Thanks for the information,
However the system doesn't have a tool for the operation that I doing nor do I want to add one to the toolbar.

I have gone about it in another way. I am using the OnClick method of the map object, that can call a event delegate that my menu option can add or remove.

Now all I have to do is change the cursor Icon when I activate my delegate. back to the help files
0 Kudos
NeilClemmons
Regular Contributor III
I think you'll find that things will be much easier if you simply write a custom tool for this.  That's how the system is designed.
0 Kudos