Community of VE/MapPoint Users and Developers
This is a discussion on Detecting when a line is clicked on in MP2K within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have a series of pickup/drop off address pairs. I make a pushpin for pickup and one for dropoff, and ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Detecting when a line is clicked on in MP2K I have written a mousedown even that is able to detect if a pushpin is clicked, but I don't seem able to see if the line between them has been clicked on. What I want to be able to do here is process the some code if they click on either pushpin OR the line connecting them. TIA. Dim oMap As MapPointCtl.Map Dim oResults As MapPointCtl.FindResults Dim oResult As Object On Error Resume Next Set oMap = Form1.MappointControl1.ActiveMap Set oResults = oMap.ObjectsFromPoint(X, Y) For Each oResult In oResults if Left(oResult.Name, 2) = "PU" or _ Left(oResult.Name, 2) = "DO" Then <code here to process the Pickup or Dropoff> Next |
| ||||
|
Put the getItemType Function in a Module In a CommandButton you could call the function like this: (with an item on the map selected!) Code: Dim objmap As MapPointCtl.Map Set objmap = MappointControl1.ActiveMap MsgBox GetItemType(objmap.Selection) Code: MsgBox GetItemType(pNewSelection) Code: Function GetItemType(ByVal iSelection As Object)
On Error GoTo error:
If TypeOf iSelection Is Pushpin Then
GetItemType = "Pushpin"
Exit Function
End If
If TypeOf iSelection Is Location Then
Set objLoc = iSelection
Select Case objLoc.Type
Case "-1"
GetItemType = "Road, Street Address, or Other"
Case "8"
GetItemType = "City"
Case "17"
GetItemType = "Region2"
Case "18"
GetItemType = "Region1"
Case "19"
GetItemType = "Country"
Case Else
GetItemType = "Location Type: " & objLoc.Type
End Select
'There are more of these but the most common is US are here
Exit Function
End If
If TypeOf iSelection Is Waypoint Then
Dim objWayPoint As MapPointCtl.Waypoint
Set objWayPoint = iSelection
Select Case objWayPoint.Type
Case "1"
GetItemType = "Waypoint type: geoWaypointStart (Start of Route)"
Case "2"
GetItemType = "Waypoint type: geoWaypointStop (Intermediate stop)"
Case "3"
GetItemType = "Waypoint type: geoWaypointEnd (End of Route)"
End Select
Exit Function
End If
If TypeOf iSelection Is Route Then
GetItemType = "Route"
Exit Function
End If
Dim obj1 As MapPointCtl.Shape
Set obj1 = iSelection
Select Case obj1.Type
Case Is = "1"
Select Case obj1.AutoShapeType
Case "1"
GetItemType = "Rectangle"
Case "9"
GetItemType = "Oval"
Case "1009"
GetItemType = "Circle based on a radius"
End Select
Case Is = "5"
GetItemType = "geoFreeform"
Case Is = "9"
GetItemType = "geoLine"
Case Is = "17"
GetItemType = "geoTextBox"
Case Else
GetItemType = "Can Not Determine Type of Shape"
End Select
Exit Function
error:
GetItemType = "Can Not Determine Type of Object"
End Function
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
![]() |
| Tags |
| clicked, detecting, line, mp2k |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| detecting mappoint in vba | OregonIzer | MapPoint 2006/2009 Discussion | 4 | 07-21-2005 12:56 PM |
| Retrieve the clicked country name | Abilio Serafim | MapPoint 2006/2009 Discussion | 0 | 04-27-2005 07:10 AM |
| Detecting the currently selected pushpin | daxydoggie | MapPoint 2006/2009 Discussion | 2 | 11-19-2003 04:57 AM |
| Return the state that is being clicked on | Tarren | MapPoint 2006/2009 Discussion | 8 | 04-10-2003 02:31 PM |
| As I draw a line and then a pushpin on that line, .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 07-16-2002 09:35 AM |