Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 4 of 4

Custom context menu

This is a discussion on Custom context menu within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    I'm also interested in a custom properties menu -- anybody have any idea on this?

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Disable Context menu
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 12
    Last Post: 12-23-2008, 01:05 PM
  2. Click events of context menu are not firing....
    By Learner in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 05-12-2008, 03:33 PM
  3. By Right-click displaying context menu on map
    By Banu in forum MapPoint Desktop Discussion
    Replies: 19
    Last Post: 10-16-2007, 08:46 AM
  4. Extending MapPoint - How about the Context Menu Enhancements
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 02-10-2004, 10:38 AM
  5. VB.NET & overriding the map point context menu...
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-05-2002, 09:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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