Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 4 of 4

Help: convert VB code to Delphi!

This is a discussion on Help: convert VB code to Delphi! within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Simple cast the variable:

    objpin:=pushpin(map.activemap.selection)

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Convert Lat Lon to X Y
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 9
    Last Post: 04-27-2006, 11:09 AM
  2. Convert .ptm to .jpg
    By dkirk in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 03-03-2005, 07:10 AM
  3. Convert to Lat/Long
    By wallacech in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-26-2004, 01:37 PM
  4. Convert to Add-In
    By David Kachuck in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-06-2003, 04:41 PM
  5. Problems with Dutch ZIP codes (bug?) (Delphi code provided)
    By schuchhardp in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-28-2002, 04:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96