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.
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 ...
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.
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 IfCode:'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"
John
http://www.support-pc.com
Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Many thanks, will give that a go
There are currently 1 users browsing this thread. (0 members and 1 guests)