MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Help: convert VB code to Delphi!

This is a discussion on Help: convert VB code to Delphi! within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Here is the VB code: Dim objPin As MapPoint.Pushpin Set objPin = MPMap.ActiveMap.Selection Here is my delphi code: var objpin ...


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

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



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-07-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Help: convert VB code to Delphi!

Here is the VB code:

Dim objPin As MapPoint.Pushpin
Set objPin = MPMap.ActiveMap.Selection


Here is my delphi code:

var
objpinushpin
begin
objpin:=map.activemap.selection

[Erreur] Unit1.pas(734): Types incompatibles : 'IDispatch' et 'Pushpin'

Regards, SD
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 07-08-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Simple cast the variable:

objpin:=pushpin(map.activemap.selection)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 07-08-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 10-06-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
re: Help: convert VB code to Delphi!

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
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
code, convert, delphi


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/help-convert-vb-code-delphi-3005.html

Posted By For Type Date
MetaGer, Suche nach: typeof delphi This thread Refback 07-02-2008 03:54 AM

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
Convert Lat Lon to X Y Dazzer MapPoint 2006/2009 Discussion 9 04-27-2006 10:09 AM
Convert .ptm to .jpg dkirk MapPoint 2006/2009 Discussion 6 03-03-2005 06:10 AM
Convert to Lat/Long wallacech MapPoint 2006/2009 Discussion 1 02-26-2004 12:37 PM
Convert to Add-In David Kachuck MapPoint 2006/2009 Discussion 0 07-06-2003 03:41 PM
Problems with Dutch ZIP codes (bug?) (Delphi code provided) schuchhardp MapPoint 2006/2009 Discussion 2 11-28-2002 03:37 AM


All times are GMT -5. The time now is 03:44 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Ibiza Holiday
Visit the party capital of Europe with an Ibiza holiday! Check out the deals online on UlookUbook...



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 56 57 58 59