Pushpin

Anonymous
06-29-2004, 07:31 PM
Sorry for my english

If i have a location, how i con know the name of pushpin that is in that location?

thanks!!!!
:)

jdwhytie
06-30-2004, 09:48 AM
Use the name property of your location object: objLoc.Name

Anonymous
06-30-2004, 03:54 PM
Sorry, but the question is:

i like to know what is the of a PushPin when I press the right Button.

jdwhytie
07-02-2004, 11:10 AM
I've not really done much with all this but I played around for a while and this code will make the pushpin name box pop up when you right click on a pushpin

Private Sub objMap_BeforeClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean)
On Error GoTo Err_OnClick
Dim objResults As Mappoint.FindResults
Dim objResult As Object

If Button = 2 Then
'Display the name of the object best matching where user clicks on map
Set objResults = objMap.ObjectsFromPoint(X, Y)
objResults.Item(1).BalloonState = geoDisplayName
Cancel = True
End If

Exit_OnClick:
If Err <> 0 Then
MsgBox Err & " " & Err.Description
End If
Exit Sub

Err_OnClick:
'If the object isn't a pushpin then ignore it
If Err = 438 Then
Resume Next
Else
Resume Exit_OnClick
End If

End Sub

It uses the ObjectsFromPoint() Method to find objects around a screen coordinate. This includes addresses as well as pushpins, but we're only interested in pushpins, so we take only the first record returned by ObjectsFromPoint(). Also this method can return addresses and other locations in addition to pushpins, but that'll screw things up so there is the error handling that ignores the times when a user clicks an area where there is no pushpin.

Also, I added the "Cancel = True" to prevent the menu from coming up on the right click (Button = 2)

One more thing, be sure to include the "WithEvents" keyword when you declare you objMap

Hopefully this is along the lines of what you were looking for
-Jake

Anonymous
07-03-2004, 04:43 AM
VERY VERY VERY THANKS.

clavijo
07-05-2004, 02:51 AM
Hola Eva.

Para hacer lo que necesitas tienes que usar primero el método ObjectsFromPoint (que te coge todos los objetos que hay en un punto), y luego el método objFindResults.Item(1) para tener acceso a ese objeto que haya donde hayas pinchado.

En este caso yo sé que donde pincho hay un objeto pushpin:

Set objFindResults = objMapa.ObjectsFromPoint(x, y)
Set objPin = objFindResults.Item(1)

Lo del botón derecho del ratón creo que lo puedes controlar con If button=2 then .....

 
Web mp2kmag.com
mapforums.com