MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Detecting when a line is clicked on in MP2K

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-17-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Detecting when a line is clicked on in MP2K

I have a series of pickup/drop off address pairs. I make a pushpin for pickup and one for dropoff, and draw a line between them.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 01-21-2003
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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)
from within the SelectionChange event:
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
clicked, detecting, line, mp2k


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 12:13 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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