Google Map

Google Map

Postby Silvio.Falconi » Wed Feb 02, 2022 12:25 pm

On a old App (fwh) I had a dialog to show a map, now not run


Image



Code: Select all  Expand view


function Show( cStreet, cCity, cCountry, oActiveX )

   local cHtml := MemoRead( ".\MAPPE\gmap.html" )

   cHtml = StrTran( cHtml, "<<STREET>>", AllTrim( cStreet ) )
   cHtml = StrTran( cHtml, "<<CITY>>", AllTrim( cCity ) )
   cHtml = StrTran( cHtml, "<<COUNTRY>>", AllTrim( cCountry ) )

   MemoWrit( "temp.html", cHtml )

   oActiveX&#058;Do( "Navigate2", CurDrive() + ":\" + CurDir() + "\temp.html" )

   return nil




gmap.html
Code: Select all  Expand view
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">                                                                  
  <head>                                                                                                      
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title> </title>            
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAtOjLpIVcO8im8KJFR8pcMhQjskl1-YgiA_BGX2yRrf7htVrbmBTWZt39_v1rJ4xxwZZCEomegYBo1w" type="text/javascript"></script>
    <script type="text/javascript">                                      
    var map = null;                                                      
    var geocoder = null;                                                
    var coords = null;                                                  

    function initialize() {                                              
      if (GBrowserIsCompatible()) {                                      
        map = new GMap2(document.getElementById("map_canvas"));          
        map.addControl(new GLargeMapControl());                          
        map.addControl(new GMapTypeControl());                          
        geocoder = new GClientGeocoder();                                
      }                                                                  
    }                                                                    

    function showAddress(address, cAddressName) {                        
      if (geocoder) {                                                    
        geocoder.getLatLng(                                              
          address,                                                      
          function(point) {                                              
            if (!point) {                                                
              showAddress2('<<CITY>>');              
            } else {                                                    
              map.setCenter(point, 15);                                  
              var marker = new GMarker(point);                          
              map.addOverlay(marker);                                    
              coords = marker.getPoint();                                
              var curl = cAddressName + "<p>" + coords.toUrlValue(6) + "</p>"
              var button = '<input type="button" value="Imprimir" onClick="window.print()"/>;'
              curl = curl + button
            }                                                            
          }                                                              
        );                                                              
      }                                                                  
    }                                                                    
    function showAddress2(address) {      
      if (geocoder) {                                                    
        geocoder.getLatLng(                                              
          address,                                                      
          function(point) {                                              
            if (!point) {                                                
              alert(address + " not found");                        
            } else {                                                    
              map.setCenter(point, 15);                                  
              var marker = new GMarker(point);                          
              map.addOverlay(marker);                                    
              marker.openInfoWindowHtml(address);                        
            }                                                            
          }                                                              
        );                                                              
      }                                                                  
    }                                                                    
    </script>                                                            
  </head>                                                                

  <body onload="initialize(); showAddress('<<STREET>>, <<CITY>>  <<COUNTRY>>', '<<STREET>>, <<CITY>>  <<COUNTRY>>');" onunload="GUnload()"
        <div id="map_canvas" style="width: 597px; height: 376px"></div>
  </body>                                                                
</html>                                                                  
 



where is the error ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm

Re: Google Map

Postby karinha » Wed Feb 02, 2022 12:52 pm

oActivex:Silent := .T. // Para Evitar: Erro de Script na Pagina.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7456
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Google Map

Postby Silvio.Falconi » Thu Feb 03, 2022 10:09 am

But not run the script
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm

Re: Google Map

Postby Silvio.Falconi » Thu Feb 03, 2022 10:11 am

But not run the script
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm

Re: Google Map

Postby cnavarro » Thu Feb 03, 2022 2:30 pm

Silvio replace in your code old ActiveX with "InternetExplorer.Application" with webview

viewtopic.php?f=3&t=41143&start=30#p247840
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6515
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Google Map

Postby Silvio.Falconi » Fri Feb 18, 2022 8:44 pm

Resolved with WebMap class

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6871
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 147 guests