MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Disable Context menu

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-22-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Disable Context menu

Ive had this problem for a few days now, and I am all out of ideas. I am using the selection change event to display custom context menus depending on which pushpin the user rightclicks on. However, the default context menu pops up after my menu. Initially I though i could just use "cancel" in the before_click event, but if i cancel that event, then no selection_change event occurs and I get no menu at all.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 04-23-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
Hi,

Quote:
Initially I though i could just use "cancel" in the before_click event, but if i cancel that event, then no selection_change event occurs and I get no menu at all.
What if you use cancel only if right button is clicked ? I think you have that option to check in BeforeClick. I'm sure other solutions are possible but this is what drop into my head at first glance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 04-25-2005
Junior Member
White Belt
 
Join Date: Apr 2005
Posts: 5
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 04-26-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-23-2005
Junior Member
White Belt
 
Join Date: Apr 2005
Posts: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-24-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
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 ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 05-24-2005
Junior Member
White Belt
 
Join Date: Apr 2005
Posts: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 05-25-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 05-25-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
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();
            }
This handles of course only pushpins. I dont know if there is a method in mappoint to select() any objec if it is selectable. But if this works I think you are in a better direction, right ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 05-27-2005
Junior Member
White Belt
 
Join Date: Apr 2005
Posts: 5
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
context, disable, menu


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 07:15 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52