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 7 of 7

PushPin on a Timer(Vb6)

This is a discussion on PushPin on a Timer(Vb6) within the MapPoint Desktop Discussion forums, part of the Map Forums category; (I´m sorry for my english) Hello. I have a problem with PushPin ...expect you can help me. Taking(Catching) the information ...

  1. #1
    ikercio is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    11

    PushPin on a Timer(Vb6)

    (I´m sorry for my english)Hello. I have a problem with PushPin ...expect you can help me. Taking(Catching) the information of
    a recordset I add a pushpin. When I add the second one I remove the Previous and this way successively.
    All This to simulate movement ....but I dont want seen the tour. I have done this code but it is not a good code
    and is very slow:

    Private Sub Timer1_Timer()




    If iTime > 0 Then
    iLatid = rs("lat")
    iLong = rs("lon")


    iContPin = iContPin + 1 'para darle nombre al pushPin

    objMap.AddPushpin objMap.GetLocation(iLatid, iLong), iContPin

    If sw = False Then
    sw = True
    Else
    Set objPin = objMap.FindPushpin(iContPin - 1)

    objPin.Delete
    End If

    rs.MoveNext

    ' Si no sobrepasó el final del recordset ...
    If rs.EOF Then
    ' se posiciona en el ultimo
    rs.MoveLast
    MsgBox " Se está en el ultimo registro ", vbInformation
    iTime = 0
    End If

    End If


    End Sub



    Thank you very much in advance.

    ikercio

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: PushPin on a Timer(Vb6)

    Hi,

    It is better to move the pushpin instead of every time create one and delete the other. You can move it by just change the Location property of it.

  3. #3
    ikercio is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    11

    Re: PushPin on a Timer(Vb6)

    Quote Originally Posted by Wilfried View Post
    Hi,

    It is better to move the pushpin instead of every time create one and delete the other. You can move it by just change the Location property of it.

    ok. The first time To Add a Push pin :


    If iTime > 0 Then
    iLatid = rs("lat")
    iLong = rs("lon")


    iContPin = iContPin + 1 'para darle nombre al pushPin

    objMap.AddPushpin objMap.GetLocation(iLatid, iLong), iContPin

    and....After that.....to move this Pushpin????how can i do it???


    Thanks

    ikercio

  4. #4
    ikercio is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    11

    Re: PushPin on a Timer(Vb6)

    How can I change the Location property of a pushpin to move it??


    Thanks


    Ikercio

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: PushPin on a Timer(Vb6)

    Hi,

    From the top of my head:

    Code:
    // this must be a static variable, so don't put it on the stack
    private PushPin pp;
    
    // then routine something like this
    Location location = map.GetLocation(lat, lon, 1);
    if (pp == null)
       pp = map.AddPushPin(location, name);
    else
      pp.Location = location;
    Also you have to put the last part into an exception block, because a user can delete the pushpin.

  6. #6
    ikercio is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    11

    Re: PushPin on a Timer(Vb6)

    Quote Originally Posted by Wilfried View Post
    Hi,

    From the top of my head:

    Code:
    // this must be a static variable, so don't put it on the stack
    private PushPin pp;
    
    // then routine something like this
    Location location = map.GetLocation(lat, lon, 1);
    if (pp == null)
       pp = map.AddPushPin(location, name);
    else
      pp.Location = location;
    Also you have to put the last part into an exception block, because a user can delete the pushpin.

    Thanks but....."Location property (Location)
    Returns the specified Location object. Allows access to the location of members of a FindResults collection without determining the type of the result (that is, whether a member of the collection is a Pushpin or Location object). Read-only"

    But Location is a OnlyRead Property......no????

    something more...please??

    Ikercio

  7. #7
    ikercio is offline Junior Member White Belt
    Join Date
    Dec 2007
    Posts
    11

    Re: PushPin on a Timer(Vb6)

    Yesssss!!

    this is the code for vb to add a PushPin and after to move it:

    Private Sub Timer1_Timer()

    If iTime > 0 Then
    iLatid = rs("lat")
    iLong = rs("lon")


    iContPin = iContPin + 1 'para darle nombre al pushPin




    If sw = False Then
    sw = True
    Set objPin = objMap.AddPushpin(objMap.GetLocation(iLatid, iLong), iContPin)
    Else

    Set objLoc = objMap.GetLocation(iLatid, iLong)


    Set objPin.Location = objLoc

    End If

    rs.MoveNext

    ' Si no sobrepasó el final del recordset ...
    If rs.EOF Then
    ' se posiciona en el ultimo
    rs.MoveLast
    MsgBox " Se está en el ultimo registro ", vbInformation
    iTime = 0
    End If

    End If


    End Sub


    Thanks!!!!!!!!!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Timer and Server Busy
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-07-2004, 03:59 AM
  2. Finding Pushpin Name by clicking on the Pushpin?(MP 2002)
    By NickSP in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-10-2003, 01:11 PM

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