I am trying to write some code which mimicks the behaviour of clicking on a direction line in a calculated route, i.e. the map is zoomed to show a good view of this road segment in green, the turn is highlighted blue, a pushpin is placed at the turn location with the pop-up text being the turn instruction.
I have tried the following code:
Dim oMap As MapPoint.Map
Dim oRte As MapPoint.Route
Set oMap = GetObject(, "MapPoint.Application").ActiveMap
Set oRte = oMap.ActiveRoute
oRte.Waypoints.Add oMap.FindAddressResults(, "London", , ) (1)
oRte.Waypoints.Add oMap.FindAddressResults(, "Birmingham", , ) (1)
oRte.Calculate
Dim i As Integer
Dim loc As MapPoint.Location
For i = 1 to oRte.Directions.Count
loc := oRte.Directions.Item[i].Location
loc.GoTo
loc.Highlight = true
MsgBox "Here is a turn"
Next i
This runs, but the behaviour is not as expected. The locations returned display larger sections of the route, and is centered on what seems an arbitary point, there is no highlighting, and no pushpin.
Can anyone help with reproducing this behaviour.
Thanks Brian