Community of VE/MapPoint Users and Developers
This is a discussion on Capturing Pushpin movement within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am creating an application in VB.net that uses the Mappoint com control. I need to be able to do ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Capturing Pushpin movement 1. Block the user from being able to select and move pushpins(separate tasks) 2. When a pushpin is moved, I need to know that it has moved, which pin it is, and what it's new location is. I do not know how to detect pin movement. |
| ||||
|
Not sure if this will solve your problem but maybe it will help a little? in the BeforeClick event you can set Cancel = True to cancel the users click. (either Right or Left Click) This would disable the left mouse button on the map itself (prevent them from moving the pushpin) If you change it to Button =2 then you disable right click menu. If you remove the if statment and just leave Cancel = True you disable left or right click. Code: Private Sub MappointControl1_BeforeClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean) If Button = 1 Then Cancel = True End If End Sub
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| Thank you
thank you so much. I appreciate your reply. I do have more questions, however. Is there any way to allow the user to select a pushpin, but prevent them from moving it? Also, How can I tell when a pushpin has been moved? Thank you in advance |
| ||||
|
Sonya, There really is not an easy way to keep users from moving the pushpins that I know of. You would have to come up with a cleaver way of doing it yourself. Off the top of my head I guess you could write code to check the position of pushpins against your database using the "AfterRedraw event" as a trigger, but depending of the number of pushpins your working with it may or may not be practical?
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| selecting pushpins
Try this: Private Sub MPC_BeforeClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean) On Error Resume Next Set oResults = MPC.ActiveMap.ObjectsFromPoint(X, Y) For Each oResult In oResults If TypeOf oResult Is Pushpin Then Cancel = True ........... You only use "Cancel=True" if it is a Pushpin what you have selected |
| |||
|
I had an almost working method like what Manuel proposes. But then you have to account for double-clicking, overlapping pushpins, highlighting of pushpins, and other problems that escape my memory. I did go this route but went back. Moveable pushpins caused less problems that all the other issues. |
| |||
| How to disable pushpin movement
Try this: Private Sub mapMain_SelectionChange(ByVal sender As Object, ByVal e As AxMapPoint._IMappointCtrlEvents_SelectionChangeEve nt) Handles mapVenders.SelectionChange Dim sp As MapPoint.Shape Dim loc As MapPoint.Location Try If TypeOf (e.pNewSelection) Is MapPoint.Pushpin Then loc = mapVenders.ActiveMap.GetLocation(80, 0) 'get a location over at the north pole sp = mapVenders.ActiveMap.Shapes.AddShape(MapPoint.GeoA utoShapeType.geoShapeRectangle, loc, 1, 1) sp.Select() sp.Delete() End If Catch e1 As Exception 'exit gracefully End Try End Sub Basically what this will do is that every time you select a pushpin then this will create a small, barely noticeable shape over at the north pole, thus shifting the selection to that shape, and then it deletes it so no traces of what happened are left. This will effectively disallow the user from moving pushpins. If you want to leave the pushpin selected, you could try reselecting it with the e.pNewSelection instance, but I'm not sure if the movement will still be disallowed that way. Obviously this is the way that you will know which pushpin was moved, but again I haven't tried if it also has the new location with it. I'm using the method above and has always worked for me, so I guess you won't have any problems with it. Good luck and hope this helps you. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Capturing Mouse Wheel Event | Anonymous | MapPoint Web Service and Virtual Earth | 2 | 11-30-2005 07:31 AM |
| Capturing Pushpin movement | huggesc | MapPoint 2006/2009 Discussion | 0 | 11-12-2003 04:08 PM |
| Finding Pushpin Name by clicking on the Pushpin?(MP 2002) | NickSP | MapPoint 2006/2009 Discussion | 4 | 01-10-2003 12:11 PM |
Flight Departures
Check Holiday Hypermarket to find flight departures to numerous exotic destinations. We link to details on flight departures and arrivals to help you find information fast.
Travel Counsellors
Travel Counsellors are an award winning Travel Agent. Have a personal Travel Counsellor help with your travel plans.
Cape Town Flight
Book a Cape Town Flight for great value when you book through dealchecker.co.uk. It doesn't take long to find the latest great deals for you.
Holidays in Dubai
Holidays in Dubai are an eclectic mix of the ancient and the modern. Discover an oasis of luxury amid the Arabian desert. Book here now!
Holidays
For bargain holidays to destinations including Mexico, South Africa, India and more, visit ULookUBook online today. Check out our free travel guides to help you make an informed decision for your holidays.
Cheap Travel
For cheap travel options, visit Travel.co.uk and explore the benefits of our comparison site.
Holidays to Goa
Golden beaches, coconut trees. Visit On The Beach for holidays to Goa, and experience India!