Is there any event generated or any other way of knowing when the route has been changed?
This is a discussion on Is there any event for when the route is changed? within the MapPoint Desktop Discussion forums, part of the Map Forums category; Is there any event generated or any other way of knowing when the route has been changed?...
Is there any event generated or any other way of knowing when the route has been changed?
There's the RouteAfterCalculate event, which is called with the route object as a parameter - see the Help file for documentation.
I see there's also a RouteAfterOptimize() which will work in a similar manner.
(you might want to trap both of them)
Richard
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Those will tell you when MapPoint has modified a route.
Trapping when the user has modified a route might be a bit more difficult.
Perhaps check the number of waypoints in the route? Have they been added or removed?
Richard
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Thanks for that but I really need to know when the user either removes or adds an item to the route.
There is property called "IsCalculated". Thats what you need.
I needed an actual event not a property, i.e. to be notified as soon as a waypoint is added or removed and what the waypoint was.
There is no event that will do that so easy. I have used the OnAfterRedraw-event. When a waypoint is added, the map is redrawed. Maybe you use an own temp route list and compare it with the Mappoint routelist. Then you have the waypoint position which is changed.
thanks for that suggestion - ii will try it out
I have try out the SelectionChange event, thats better for your Problem i think. That event occurs, for example when a new waypoint is added.
How about using the SelectionChange event? You can test for TypeOf is WayPoint then do your stuff:
Code:Private Sub map_SelectionChange(ByVal pNewSelection As Object, ByVal pOldSelection As Object) If TypeOf pNewSelection Is Waypoint Then ' check to see if it's an addition or deletion, etc If map.ActiveMap.ActiveRoute.Waypoints.Count > oldcount Then ' if it's an addition ElseIf map.ActiveMap.ActiveRoute.Waypoints.Count < oldcount Then ' if it's a deletion End If End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)