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

Capturing Pushpin movement

This is a discussion on Capturing Pushpin movement within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Capturing Pushpin movement

    I am creating an application in VB.net that uses the Mappoint com control. I need to be able to do 2 things:

    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.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    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

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    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?

  5. #5
    Manuel is offline Junior Member White Belt
    Join Date
    Nov 2002
    Posts
    4

    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

  6. #6
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Capturing Mouse Wheel Event
    By Anonymous in forum Bing Maps and MapPoint Web Service
    Replies: 2
    Last Post: 11-30-2005, 07:31 AM
  2. Capturing Pushpin movement
    By huggesc in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-12-2003, 04:08 PM
  3. Finding Pushpin Name by clicking on the Pushpin?(MP 2002)
    By NickSP in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-10-2003, 12:11 PM

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