MapPoint Forums

MapForums

Community of VE/MapPoint 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: ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  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


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 04:21 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5
MP2K Magazine
Visitor Map

Flights from East Midlands Airport
Book low cost airline flights from East Midlands Airport. Holiday Hypermarket let you search for great deals from top tour operators.

Italy Weather
Check out Italy Weather - Travel Counsellors details information on Italy including, weather, flights and accommodation.

Flights to Cape Town
Before booking flights to Cape Town visit dealchecker.co.uk to make sure you are getting the best deal in town. Visit online today and try the holiday search for free.

St Lucia Holidays
St Lucia holidays offer something for everyone. Enjoyed by families and young couples alike, St Lucia is a great destination. See online!

Cheap Turkey Holidays
The best time of year to sneak in cheap Turkey holidays is during the off-peak season. Check out the great deals available during April, May or October. For other tips on how to bag a great value holiday simply check online at ulookubook.com

Inclusive package holidays
Choose one of the many inclusive package holidays at Travel.co.uk and save a lot of trouble and money too!

Cheap Holidays in Sharm el Sheikh
Egypt awaits! Visit On The Beach for info on cheap holidays in Sharm el Sheikh.


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