MappointControl and Pushpin

Anonymous
06-30-2004, 08:34 AM
I am building a standalone (not addin) VB6 App based around the MappointControl. Does anyone know if it is possible to use the MapPointControl to select a point on the map and progmaticly with the mouse and add a pushpin from the location of the mouse click on the map?

I expect it is somehow possible using one of the events avaliable to the MapPoint control such as :

AfterRedraw
AfterViewChange
BeforeClick
BeforeDblClick
DataMapChange
MouseDown
MouseMove
MouseUp
NewDataSet
ReadyStateChange
RouteAfterCalculate
RouteAfterOptimize
SelectionChange

however I have not been able to dynamicaly obtain a address upon catch of lets say a MouseDown event, geocode it and convert it progmaticly to add the pushpoint.

Thanks in advance!!!

Anonymous
07-01-2004, 01:59 PM
Here's what I'm thinking use the MouseDown event and

objMap.XYToLocation(MouseX, MouseY)
'where MouseX and Y refer to the Mouse location on the screen

Then assign the location returned by this to a new pushpin

jdwhytie
07-02-2004, 10:02 AM
I tried out this code, it adds a pushpin to the map (objMap) when you click the left and right mouse buttons together (all you have to do is change the Button value to switch)

Private Sub objMap_BeforeClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean)
If Button = 3 Then
Dim pinLoc As Mappoint.Location
Set pinLoc = objMap.XYToLocation(X, Y)
objMap.AddPushpin pinLoc, "great"
pinLoc.goto
End If
End Sub

Hope this helps you

Anonymous
07-02-2004, 12:35 PM
Outstanding! Thank you very much!!! I appreciat very much!

Anonymous
07-06-2004, 08:11 AM
This works great except when I click on a geocodable location, at that point Mappoint default behavior pops up a listbox with addresses in it. I'd like to retrieve the address chosen from the list box and then place the pushpin. This would solve the problem. Any sugestions? To reproduce what I am talking about just zoom in close enough so you can percisly click on a road.

Thanks!

 
Web mp2kmag.com
mapforums.com