Anonymous
07-07-2004, 10:36 AM
Here is the VB code:
Dim objPin As MapPoint.Pushpin
Set objPin = MPMap.ActiveMap.Selection
Here is my delphi code:
var
objpin:pushpin
begin
objpin:=map.activemap.selection
[Erreur] Unit1.pas(734): Types incompatibles : 'IDispatch' et 'Pushpin'
Regards, SD
Anonymous
07-08-2004, 04:58 AM
Simple cast the variable:
objpin:=pushpin(map.activemap.selection)
Anonymous
07-08-2004, 07:25 AM
Code compile, but objpin method or property don't work.
I want to use this code to get Pushpin user click.
Here's the complete VB code:
Dim objPin As MapPoint.Pushpin
' Check if the user double-clicked on a pushpin
If Not MPMap.ActiveMap.Selection Is Nothing Then
If TypeOf MPMap.ActiveMap.Selection Is MapPoint.Pushpin Then
Set objPin = MPMap.ActiveMap.Selection
' Do whatever with the pushpin...
' We've handled this double-click
Cancel = True
End If
End If
End Sub
Anonymous
10-06-2004, 01:02 PM
Seb,
You may want to make sure that the Map.Selection reference ( to the object the user cliked on ) is actually a PushPin. It might be of some other type, like Location for instance.
///// suggestion
var ppClickedPushPin:PushPin;
...
if Map.ActiveMap.Selection<>nil then Map.ActiveMap.Selection.QueryInterface(IID_Pushpin , ppClickedPushPin);
if ppClickedPushPin<>nil then
begin
// use ppClickedPushPin here
end;
/////
/jean-phi