PDA

View Full Version : Pushpins



amanuel
08-08-2002, 03:04 PM
Hi guys,
I am trying to integrate mappoint with our application, I was able to locate the addresses that we want on mappoint However when i select those pushpins that i have added it seems like i can only find the one that i clicked on. Here is my code
If TypeOf g_oApp.ActiveMap.Selection Is Pushpin Then
msgbox g_oApp.ActiveMap.Selection.Name
End If
what i want to know is, if there is a collection which holds all the selected pushpins.
Thank you

John Meyer
08-08-2002, 06:20 PM
Yes, the collection is a Dataset. This sample my help, here I'm using a Mappoint ActiveX Control named MPC. (By Default it would be named MappointControl1.)

Dim objDataSet As MapPointCtl.DataSet
Dim objmap As MapPointCtl.Map
Dim objRecordset As MapPointCtl.Recordset

Set objmap = MPC.ActiveMap
For Each objDataSet In objmap.DataSets
If InStr(objDataSet.Name, "My Pushpins") Then
Set objRecordset = objDataSet.QueryAllRecords
'objDataSet.ZoomTo
Do Until objRecordset.EOF
objRecordset.Pushpin.Symbol = 20
objRecordset.MoveNext
Loop
End If
Next

amanuel
08-09-2002, 08:57 AM
John,
Your solution gives me all the pushpins in the dataset, but what i want is the once which are selected or highlighted.

John Meyer
08-09-2002, 09:33 AM
This will only change the pushpin if it is highlighted.

Dim objDataSet As MapPointCtl.DataSet
Dim objmap As MapPointCtl.Map
Dim objRecordset As MapPointCtl.Recordset

Set objmap = MPC.ActiveMap
For Each objDataSet In objmap.DataSets
If InStr(objDataSet.Name, "My Pushpins") Then
Set objRecordset = objDataSet.QueryAllRecords
'objDataSet.ZoomTo
Do Until objRecordset.EOF
If objRecordset.Pushpin.Highlight = True Then
objRecordset.Pushpin.Symbol = 20
End if
objRecordset.MoveNext
Loop
End If
Next