Community of VE/MapPoint Users and Developers
This is a discussion on Disable Context menu within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Ive had this problem for a few days now, and I am all out of ideas. I am using the ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Disable Context menu I have gotten around this before by displaying my menu from the before_click function. That worked fine when there was only one context menu. But now I need to have a different menu for each pushpin set. I dont know of anyway to do that from the before_click event which is why i moved the code to the selection_change event. I am using c# by the way. Any help or ideas would be greatly appriciated. Thanks |
| |||
|
Hi, Quote:
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Thanx for your reply. Canceling only on right clicks is what I was referring to. But that means that right clicks can no longer trigger selection change events, so my menus wont work when someone right clicks on an icon. |
| |||
|
Hi, I understeand. I was thinking that the e.cancel only canceled the popup menu, but of course it cancel the action, whatever it is. Since you definily need both of the events maybe the workaround is to get rid of the popup menu by sending escape key to it. Then you can go along and still think on a better solution.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi, it's been a little while since I originally posted this question. I used the esc key workaround suggested by Wilfried and it allowed me to continue on with other things. However, now I am back at the context menu problem again, and I still have not though of a good way of solving it. I am beginning to think that maye I cant disable the context menus without also disabling selection_change event. In which case, I need to come up with another way of determining which pushpin was clicked on so that I know which menu to pop up. So if anyone has any ideas on how to disable the menus without canceling the selction change event, or a way to determing which pushpin is being clicked without having to use the selection change event, I would greatly appriciate it. Thanks for your help |
| |||
|
Hi, Sometime (often) time brings the light I cannot test this, but there are some things you can use. There is a property ActiveMap.Selection, witch gives you the selected object if any. So what you can do is send the escape key to get rid of the popup menu, but first you get the selected object of course. After you send the escape you Select() the selected object again. Does that sounds pretty ? Ok this is from top of my head, but I think it should work, if not it can give additional toughts. it is also possible that you have to delay a timeslice to select again, but only a little experiment will see if it is the case. What do you think ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Thanks, that is a very good idea. I tried something very similar to that also. The problem I ran into was that if I get the selected item in the before click event, I am getting the item that they selected last time, not the one they are trying to select right now. I cant get the item they are selected right now ( or at least I dont know how to get it) until after the selection change event has occured, and by then it is too late. All I can do then is send and ESC key after my menu pops to cancel the other menu. This does get the job done, but it does not look good (sometimes you can still see the mappoint menu for a split second) and it is not completely reliable. (sometimes my menu gets the ESC and the mappoint menu pops up). I do really appriciate your help, and I have thought of few other things to try, but if you have any more ideas I would be more than happy to hear them. Thanks again GxW34 |
| |||
|
Hi, Hmm of course, in BeforeClick it is not yet clicked so not yet selected. I have no idea's right now. If I come up with something I will reply again here, maybe some others have some inspiration ? Yes sometimes you will see the mappoint menu for a small time with this approatch. I think you canonly call this a minor flaw and nothing to do unless you find another approach. It should be reliable, but then you have to do it as this: 1 send the escape key 2 post a message to custom message handler 3 let the custom message handler create your menu Windows messages events are always processed in right sequence so by doing it so, the escape key is send long before your menu is created.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi, I have another idea. In BeforeClick if you set e.cancel = true then there is no selection eather. but you know there the x and y coordinates of the mouse. So there you can do something like: Code: FindResults results = MP.ActiveMap.ObjectsFromPoint(e.x, e.y);
foreach (object o in results) {
Pushpin pp = o as Pushpin;
if (pp != null)
pp.Select();
}
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi Wilfried, I just wanted to tell you that your idea worked perfectly!! I knew the ObjectsFromPoint function existed, but I probably never would have thought of using it in this situation. Thanks for your help, I really appreciate it. GxW34 |
![]() |
| Tags |
| context, disable, menu |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Click events of context menu are not firing.... | Learner | MapPoint 2006/2009 Discussion | 6 | 05-12-2008 02:33 PM |
| By Right-click displaying context menu on map | Banu | MapPoint 2006/2009 Discussion | 19 | 10-16-2007 07:46 AM |
| Custom context menu | Anonymous | MapPoint 2006/2009 Discussion | 3 | 09-10-2004 10:15 PM |
| Extending MapPoint - How about the Context Menu Enhancements | Anonymous | MapPoint 2006/2009 Discussion | 2 | 02-10-2004 09:38 AM |
| VB.NET & overriding the map point context menu... | Anonymous | MapPoint 2006/2009 Discussion | 0 | 09-05-2002 08:25 AM |
Flights to Poland
An increasing number of cheap flights to Poland make Warsaw a city not to miss. Holiday Hypermarket help to book great value flights and accommodation too.
Portugal Weather
Check Portugal Weather before you travel. We provide information on Portugal including weather, flights and accommodation.
Italy Holiday
An Italy Holiday is full of interesting stuff for the casual tourist and even more for the educated visitor. Check out the latest great deals at dealchecker.co.uk.
Holidays to Antigua
The Holiday Place has fantastic deals on holidays to Antigua. Visit our website to view special offers on holidays to the Caribbean.
Cheap Portugal Holidays
Want to know what the best time to book cheap Portugal holidays is? Well have a look on ulookubook.com for some useful information to save your cash. Golf, tennis and cycling are all very popular here.
Cheap Inclusive
Make use of our service at Travel.co.uk to help you to research cheap inclusive holidays.
Cheap Holidays to Sharm el Sheikh
Break away to Northern Africa. Find cheap holidays to Sharm el Sheikh at On The Beach.