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

drag and drop pushpin

This is a discussion on drag and drop pushpin within the MapPoint Desktop Discussion forums, part of the Map Forums category; I want to drag a pushpin from a location to another pushpin. The idea being the user drags a vehicle ...

  1. #1
    starbuck's Avatar
    starbuck is offline Member Green Belt
    Join Date
    Oct 2003
    Posts
    68

    drag and drop pushpin

    I want to drag a pushpin from a location to another pushpin. The idea being the user drags a vehicle to a depot. Is this possible?

    Also is there a way of grabbing the push pin name you have dropped onto

    Thanks in advance.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    I hope this will get you started. For this sample you will need a circle named "MyShape" so I've included some code to create the shape, please run that code before trying the main example.

    After you have you circle on the map, add a pushpin, then drag and drop it into the circle (the depot)

    Good luck...

    Code:
    'call this sub from the MapPoint Controls AfterRedraw event
    
    On Error Resume Next
    
    Dim objmap As MapPointCtl.Map
    Set objmap = MappointControl1.ActiveMap
    Dim objShapes As MapPointCtl.Shapes
    Dim objshape As MapPointCtl.Shape
    Set objShapes = objmap.Shapes
    Dim objRecords As MapPointCtl.Recordset
    Dim objDataSet As MapPointCtl.DataSet
        
    If TypeOf objmap.Selection Is Pushpin Then
    Dim a_pin As MapPointCtl.Pushpin
    Set a_pin = objmap.Selection
           
       
     For Each objshape In objmap.Shapes
      If objshape.Name = "MyShape" Then
        For Each objDataSet In objmap.DataSets
            Set objRecords = objDataSet.QueryShape(objshape)
            objRecords.MoveFirst
                Do Until objRecords.EOF
                  If objRecords.Pushpin.Name = a_pin.Name Then
                    MsgBox "You moved " & objRecords.Pushpin.Name & " (" & a_pin.Name & ") into the circle"
                  End If
                objRecords.MoveNext
                Loop
        Next
      End If
     Next
    End If
    Code:
    'Run this at startup or from a command button
    
    Dim objmap As MapPointCtl.Map
    Set objmap = MappointControl1.ActiveMap
        
    Dim objShapes As MapPointCtl.Shapes
    Dim objshape As MapPointCtl.Shape
    Set objShapes = objmap.Shapes
    
    Set objshape = objShapes.AddShape(geoShapeRadius, objmap.FindResults("Denver, CO").Item(1), 500, 500)
    objshape.Name = "MyShape"

  3. #3
    starbuck's Avatar
    starbuck is offline Member Green Belt
    Join Date
    Oct 2003
    Posts
    68

    cool

    Many thanks, will give that a go

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Drag and Drop with mappoint
    By Ryder in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-11-2005, 02:53 PM
  2. Drag/Drop
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-01-2004, 08:04 AM
  3. drag & drop
    By starbuck in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-23-2003, 12:21 PM
  4. Mappoint 2002 OCX drop & drag
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-08-2003, 03:57 PM
  5. It is possible to drag / drop (move) an PushPin on....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-03-2001, 03:54 AM

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