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

I am trying to write some code which mimicks the b....

This is a discussion on I am trying to write some code which mimicks the b.... within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am trying to write some code which mimicks the behaviour of clicking on a direction line in a calculated ...

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

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Try "oRte.Directions(i).Select".

    For example:

    Sub Test()
    Dim oMap As MapPoint.Map
    Dim oRte As MapPoint.Route
    Set oMap = GetObject(, "MapPoint.Application").ActiveMap
    Set oRte = oMap.ActiveRoute
    oRte.Waypoints.Add oMap.FindResults("Seattle, Washington")(1)
    oRte.Waypoints.Add oMap.FindResults("Tacoma, Washington")(1)
    oRte.Calculate

    oRte.Directions(2).Location.GoTo
    oRte.Directions(2).Select

    End Sub


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using MapPoint to write to database
    By strattonn in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-24-2003, 09:51 PM
  2. I am trying to write code that centers the map on ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-19-2002, 04:18 AM
  3. I write an application that similar to find functi....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-09-2002, 10:48 PM
  4. I'm trying to write a VB MapPoint app that assists....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-26-2001, 09:56 AM
  5. I am attempting to write a com addin for mappoint ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-14-2001, 09:44 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 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