0

I have a form with a database tabel which shows me all the company address. When i click the Google maps button the following will be executed

  • the variable 'senderGoogleMaps' is filled with the company address, housenumber and city
  • a form which contains a TWebbrownse and the gmlib components will be showed

When the form is showed it must directly showing the address, but i can't get it working. To solve it i put a Tedit on that form, assing the variable to TEdit.Text and create a OnKeyDown event with the code :

 GMGeoCode.Geocode(sEdit_address.Text);
 if GMGeoCode.Count > 0 then
    GMMap.RequiredProp.Zoom:=17;
    GMMap.SetCenter(GMGeoCode[0].Geometry.Location);

This code works but i can't get it working as i descriped above, is there a simple solution to make it working.

Regards Peter

1 Answers1

0

I have been doing something like this for some time ago using the following code. You may have to change something since it is for an old version of GMLib, but you might get the idea

WebGMapsGeocoding.Address := SearchString;
if WebGMapsGeocoding.LaunchGeocoding = erOk then
  begin
    WebGMaps.MapPanTo(WebGMapsGeocoding.ResultLatitude, WebGMapsGeocoding.ResultLongitude);
    WebGMaps.Markers.Add(WebGMapsGeocoding.ResultLatitude, WebGMapsGeocoding.ResultLongitude, SearchString, '', True, True, True, False, True, 0);
  end
OZ8HP
  • 1,443
  • 4
  • 31
  • 61