MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




By Right-click displaying context menu on map

This is a discussion on By Right-click displaying context menu on map within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Right-click on a pushpin shows up a context menu. I want to display my own context menu by right-click on ...


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 02-24-2006
Junior Member
White Belt
 
Join Date: Feb 2006
Posts: 6
By Right-click displaying context menu on map

Right-click on a pushpin shows up a context menu. I want to display my own context menu by right-click on a pushpin instead of the default context menu. Any help will be appreciated.

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 02-25-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Install an event handler in BeforeClick event. 1 of the arguments is Cancel. If you set this to True the popupmenu will never popup.

If you wants to popup your own menu, then do it outside the event handler. If you do not and a user does not click within 10 seconds you will have the Server Busy popup from mappoint. This is because a popup menu is nothing more than a modal form.
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 02-27-2006
Junior Member
White Belt
 
Join Date: Jan 2006
Posts: 4
Hi Wilfried,
I have exactly the same problem as Banu. I followed your suggestion of creating an event handler for Beforeclick mappoint event and forcing the argument Cancel to be TRUE. But unfortunately, the default mappoint context menu appears.
Do you may be know the reason for this behaviour? Or how I can solve it in another way.
Thank you very much,
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 02-27-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

I just tryed the following:

Code:
    private void MP_BeforeClick_1(object sender, AxMapPoint._IMappointCtrlEvents_BeforeClickEvent e)
    {
        if (e.button == 2)
            e.cancel = true;
I I have no popup if I click right mouse butten. Did you do something different ?
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 02-27-2006
Junior Member
White Belt
 
Join Date: Jan 2006
Posts: 4
Hi,
here you have my code, I think I am doing exactly the same, don't I?
I debugged teh routine and every time that I right-clicked on the map, the function is executed the if clause is true but the default mappoint message
still appears.


void CMyAppView::OnBeforeClickMapMp(long Button, long Shift, long X, long Y, BOOL FAR* Cancel)
{
if(Button == MY_MOUSE_RIGHT_CLICK)
{
//mappoint popup menu will never popup
*Cancel = TRUE;

}
}


Thank you 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 02-28-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

You do indeed exacly the same. Hmm thinking...

Unless there is a bug in the TRUE. "Normally" 0 is false, and antithing that is not 0 is true. I recall my one of the Delphi versions (I think 2) where Borland wrote a bug in such a way that they interpreted -1 as True, 0 as false, but any other number was also false. This was leading to problems interfacing with win32 API and also with other apps (COM/DLL) of course.

So what if there is such a bug ? Is this C ? Then you can try it, because in C you can assign almost anything to anithing:

*Cancel = -1;
*Cancel = (!0);
*Cancel = 0xFFFF;
... or other combinations ...
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 03-01-2006
Junior Member
White Belt
 
Join Date: Feb 2006
Posts: 6
Hi Wilfried,

I can successfully hide mappoint's menu, but having problem with showing my menu. The syntax to show a context menu is

Show(Control control, Point pos)

What do I pass for control, MapPoint application is not a control. How do I tell menu to pop up on the mappoint window.

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
  #8 (permalink)  
Old 03-01-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

is this C# ?

Then you have a lots of overload method. Try:

Code:
PopupMenu.Show(MousePosition);
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 03-06-2006
Junior Member
White Belt
 
Join Date: Feb 2006
Posts: 6
Yes, it is C# 2005. Under my MSDN library I don't see any class by PopupMenu name. Is it a third party tool? By further search I found "DataDynamics.SharpUI.Toolbars.PopupMenu" class. Is this same class you are talking about. If not then can you tell me the name of namespace, PopupMenu class lies under.
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 03-06-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

PopupMenu was the name I given it. Sorry to be confusing

No tirth party. I also use VS2005. it is in:
System.Windows.Forms.ContextMenuStrip.

And the ContexMenuStrip is in the toolbox in Menu's and toolbars. I think it is default there as I just upgraded from Beta2 to full version and I see it there.
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, displaying, map, menu, rightclick


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
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
Extending MapPoint - How about the Context Menu Enhancements Anonymous MapPoint 2006/2009 Discussion 2 02-10-2004 10:38 AM
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 10:10 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