View Single Post

  #6 (permalink)  
Old 08-16-2005
Mohamed Mohamed is offline
Member
Green Belt
 
Join Date: Mar 2005
Posts: 97
Hi,

What I did concerning that:

1° - Create 2 Public variables in your application representing the Lat and Lon where the user is clicking in the Control ( xCoord, yCoord )

- In the initilalization of your Control, add a BeforeClick function ( Just_Get_X_Y_Coordinates ) to save always the xCoord and yCoord variables

//************************************************
PROCEDURE Just_Get_X_Y_Coordonnees(Button, Shift, X, Y,bCancel=Vrai)
xCoordonnee = X
yCoordonnee = Y
//info("Coordonnées du clic : " + x + "," + y)

RENVOYER Null
//************************************************

2° Use some function of ReverseGeocoding to get the Lat and Lon of xCoord and yCoord ( a large litterature about that exists in this forum )

2° For each PushPin Added, you had to save his Lat/Lon somewhere
( for instance in a string in PushPin Note Property where you do a concatenation of Latitude and Longitude;- so each PushPin has a unique value concerning that- and you have to save this information in a file or in a List that the user cannot see directly)

3° When somebody clicks on a PushPin, you have to test if it's a PushPin Object. If Ok, compare the Latitude an Longitude of xCoord+yCoord of clicking with the the Lat an Lon saved in the pushpin Note Property or in the file created and decide what to do ( give a message to the user that deleting or moving is forbidden ) .

It's what I did, and it works very well, not to prevent deleting or moving Pushpins but to prevent creating a New PushPin with the same Lat and Lon. But it's the same mechanism.

Basically, the idea is to know what are the cooridates where the user in clicking ( to delete, to move or to do something else ), and to compare those coordinates with the ones saved somewhere concerning your objects.



Regards
__________________
Mohamed
www.AtlasCouscous.com
Reply With Quote