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 5 of 5

Displaying context menu on right click of pushpin

This is a discussion on Displaying context menu on right click of pushpin within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I have 50 pushpins and on right click of each pushpin, I want to display the context menu and ...

  1. #1
    lakshmi_tirumal is offline Junior Member Yellow Belt
    Join Date
    Apr 2008
    Posts
    27

    Displaying context menu on right click of pushpin

    Hi,
    I have 50 pushpins and on right click of each pushpin, I want to display the context menu and I want know to the pushpin name of the clicked position.

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Displaying context menu on right click of pushpin

    Hi,

    Write an event handler for BeforeClick event. There you check if a pushpin is selected and if right mouse button is clicked. If both are true you set the Cancel argument to true to disable mappoint popup menu and you can popup your own.

    To popup your own it is best to do this outside the event because if user does not click the menu for more than 10 seconds, the 'Server Busy' dialog will show. To display it outside the event handler you can post a message to a custom message handler.

  3. #3
    lakshmi_tirumal is offline Junior Member Yellow Belt
    Join Date
    Apr 2008
    Posts
    27

    Re: Displaying context menu on right click of pushpin

    Hi Wilfried,
    Thanks for the reply . My problem is that I am displaying pushpin on beforeDbl_Click event and In this event I am writing the below code

    Location ObjLocation = MPC.ActiveMap.XYToLocation(e.x, e.y);
    Pushpin ObjPushpin=MPC.ActiveMap.AddPushpin(ObjLocation, "TACK");
    ObjPushpin.Symbol = 32;
    ObjPushpin.Select();


    In SelectionChange_event I am writing

    Pushpin ObjPrevPushpin = e.pOldSelection as MapPoint.Pushpin;
    Pushpin ObjCurrPushpin = e.pNewSelection as MapPoint.Pushpin;

    if (ObjCurrPushpin != null)
    {
    General.ObjSelectPushpin = e.pNewSelection as MapPoint.Pushpin ;
    //public variable

    }


    In Before_Click event I am writing


    if (e.button == 2 && (MPC.ActiveMap.Selection.GetType() == typeof(MapPoint.Pushpin)))
    {
    ctmsZoneDefinition.Show(MousePosition);//Context menu strip
    }

    but MPC.ActiveMap.Selection.GetType() is returnig ComObject. So I am unable check the pushpin.

    Please help me

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Displaying context menu on right click of pushpin

    Hi,

    You have to change this to:

    Code:
    Pushpin pp = MPC.ActiveMap.Selection as Pushpin;
    if (e.button == 2 && pp != null) {
        ctmsZoneDefinition.Show(MousePosition); // Context menu strip
    }
    Remember also my not about displaying a context menu in an event!

  5. #5
    lakshmi_tirumal is offline Junior Member Yellow Belt
    Join Date
    Apr 2008
    Posts
    27

    Re: Displaying context menu on right click of pushpin

    Hi Wilfried,
    Thanks I got it.

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, 12: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, 02: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, 07:46 AM
  4. Custom context menu
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 09-10-2004, 10:15 PM
  5. VB.NET & overriding the map point context menu...
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-05-2002, 08: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 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127