MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Displaying context menu on right click of pushpin

This is a discussion on Displaying context menu on right click of pushpin within the MapPoint 2006/2009 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 ...


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 (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 06-10-2008
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.
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 06-10-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
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.
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 06-10-2008
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
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 06-11-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
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!
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 06-12-2008
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.
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
click, context, displaying, menu, pushpin


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/displaying-context-menu-right-click-pushpin-7805.html

Posted By For Type Date
The Magazine for MapPoint - MP2K Magazine This thread Refback 06-10-2008 07:41 AM

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 03:33 PM
By Right-click displaying context menu on map Banu MapPoint 2006/2009 Discussion 19 10-16-2007 08:46 AM
Disable Context menu Anonymous MapPoint 2006/2009 Discussion 10 05-27-2005 02:03 PM
Custom context menu Anonymous MapPoint 2006/2009 Discussion 3 09-10-2004 11:15 PM
VB.NET & overriding the map point context menu... Anonymous MapPoint 2006/2009 Discussion 0 09-05-2002 09:25 AM


All times are GMT -5. The time now is 07:06 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


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