PDA

View Full Version : Detect which right-click menu option selected?



DaveGKeller
12-07-2010, 02:37 PM
I was wondering if there is a way to detect which option is selected when the users clicks on the pop-up menu (when right-clicking a Pushpin)? I have Pushpins on my map and when the user right clicks they get the default MP pop-up menu:

http://stashbox.org/1039557/right-click-screenshot.jpg

So, for example, if they click "Rename", is there a way for me to know that is the option they picked? What I am hoping to do is kind of disable some of the options by having them do nothing. "Rename" is actually a good example because I don't want the user to be able to rename the Pushpin. So if I could detect it and then ignore it that would be a very good thing.

I'm using Visual Studio 2010 (VB.NET) and MP 2010. Any idea's or suggestions would be very welcome. Thanks.

Eric Frost
12-07-2010, 06:45 PM
See the "Events" section of the MapPoint programming model.

I don't think what you want to do is very straightforward, but you should be able to detect and revert changes such as Rename without too much trouble.

Another option would be to over-ride the right click menu completely.

Eric

DaveGKeller
12-07-2010, 07:12 PM
See the "Events" section of the MapPoint programming model.

I don't think what you want to do is very straightforward, but you should be able to detect and revert changes such as Rename without too much trouble.

Another option would be to over-ride the right click menu completely.

Eric
Thank you for that suggestion. I'll see if I can find something (hopefully not too difficult) in the Events area. If I find anything I'll post here.

I am hoping not to have to over-ride the right click menu as it has a lot of useful stuff there.

Winwaed
12-08-2010, 08:56 AM
You can use the events to trap a mouse click and to find out what was clicked/selected (eg. pushpin or shape). You can't tell which item on a menu is selected.

My approach is to override the right menu click, and show my own menu (implemented as a popup window with buttons for menu items). Yes this overrides the standard right menu, so the whole function can be switched on/off (using a menu item on the Tools menu).

Another alternative is your own popup window could have menu items that duplicate the standard ones. This could be difficult because I don't think all of those items have API functions. Also they are contextual - they change according to MapPoint's state and what has been clicked.


Richard