Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| By Right-click displaying context menu on map Thanks |
| |||
|
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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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, |
| |||
|
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;
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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! |
| |||
|
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 ...
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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 |
| |||
|
Hi, is this C# ? Then you have a lots of overload method. Try: Code: PopupMenu.Show(MousePosition);
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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. |
| |||
|
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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| context, displaying, map, menu, rightclick |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |