MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Custom context menu

This is a discussion on Custom context menu within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm asking here after searching this forum and googling for hours - I thought I'd find an answer but no ...


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

Today's Posts Twitter Feed 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 09-10-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Custom context menu

I'm asking here after searching this forum and googling for hours - I thought I'd find an answer but no joy so far.

Using the ActiveX control and .NET. All I'd like to do is create my own context menu when the user right-clicks a pushpin. I can trap when the right mouse button is clicked, but I can't seem to figure out how to get the pushpin object (or even just the Name property) from the user's click.

You can get the x,y coordinates of the click event, but how do I find a pushpin from that?

Thanks,
Mike
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 09-10-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Funny how you can search differently after you post a question. This seems to get the name ok, which I can work with, would still be open to suggestions.
Code:
private void axMap_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
{
	MapPoint.Pushpin pushPin = (MapPoint.Pushpin)e.pNewSelection;
	MessageBox.Show(pushPin.Name);
}
Mike
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 09-10-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
I'm also interested in a custom properties menu -- anybody have any idea on this?
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 09-10-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
FWIW, this is what I'm doing so far, but really, I'm not sure of the best way. I just need to put together some demo/proof of concept real quick.
Code:
		private void axMap_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
		{
			MapPoint.Pushpin pushPin = (MapPoint.Pushpin)e.pNewSelection;
			if (pushPin == null)
			{
				// I guess other objects besides pushpins can get selected.
				//MessageBox.Show("pushPin is null");
			}
			else
			{
				ContextMenu cm = new ContextMenu();
				cm.MenuItems.Add("Do something with " + pushPin.Name); // To do: Wire the event handlers.
				cm.Show(axMap, new Point(42, 42)); // Figure out how to position.
				//MessageBox.Show(pushPin.Name);
			}
		}
I hope something like that will work. Not sure about the so-called "Dreaded Server is Busy" business, looks like I need to set a timer to dispose of the context menu. Heck if I know

Mike
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, custom, 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
Disable Context menu Anonymous MapPoint 2006/2009 Discussion 12 12-23-2008 12:05 PM
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
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 02:10 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Bodrum Holiday
Check out the picturesque towns on your Bodrum holiday... Book through UlookUbook!



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 53 54 55 56 57 58 59