Jump to content

Recommended Posts

Posted

I'm having an issue with using google maps in an embedded IE control.  I'm not sure if it is a IE version (v9 on my PC) or AutoIt issue and hope someone can test this on their end.  Below is a simple test program that embeds an IE control and loads a custom marker.  The program works fine with a default icon, but with a custom marker it fails to show the marker and freezes the map after you zoom in or out.  Does someone mind trying it on their end?  Put "//" in front of the icon object to see it work correctly.

GUICreate("",800, 600)
    $gmap = _IECreateEmbedded()
    $gmap_ctrl = GUICtrlCreateObj($gmap, -1, -1, 800, 600)
    _IENavigate($gmap, "about:blank", 0)

    $html = _
    "<!DOCTYPE html><html><head><style type=""text/css"">" & @CRLF & _
      "html, body { height: 100%; margin: 0; padding: 0; overflow:hidden;}" & @CRLF & _
      "#map { height: 100%; }" & @CRLF & _
    "</style></head><body><div id=""map""></div><script type=""text/javascript"">" & @CRLF & _
    "   var map;" & @CRLF & _
    "   function initMap() {" & @CRLF & _
    "       map = new google.maps.Map(document.getElementById('map'), {" & @CRLF & _
    "           center: {lat: 26.527387,lng: -83.9892645}," & @CRLF & _
    "           zoom: 10" & @CRLF & _
    "       });" & @CRLF & _
    "       var issueIcon = {" & @CRLF & _
    "           path: 'M -45,-110 45,-110 45,-25 -45,-25 Z'," & @CRLF & _
    "           fillColor: 'yellow'," & @CRLF & _
    "           fillOpacity: 1," & @CRLF & _
    "           scale: 1," & @CRLF & _
    "           strokeColor: 'black'," & @CRLF & _
    "           strokeWeight: 1" & @CRLF & _
    "       };" & @CRLF & _
    "       var infowindow = new google.maps.InfoWindow({" & @CRLF & _
    "           content: 'test'" & @CRLF & _
    "       });" & @CRLF & _
    "       var marker = new google.maps.Marker({" & @CRLF & _
    "           position: map.getCenter()," & @CRLF & _
    "           map: map," & @CRLF & _
    "           icon: issueIcon," & @CRLF & _
    "           title: 'test'" & @CRLF & _
    "       });" & @CRLF & _
    "       marker.addListener('click', function() {" & @CRLF & _
    "           infowindow.open(map, marker);" & @CRLF & _
    "       });" & @CRLF & _
    "   }" & @CRLF & _
    "</script><script async defer src=""https://maps.googleapis.com/maps/api/js?callback=initMap""></script></body></html>"

    _IEDocWriteHTML($gmap, $html)
    ;_IEAction ($gmap, "refresh")

    GUISetState(@SW_SHOW)

    While 1
        $iMsg = GUIGetMsg()

        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect

    WEnd

    GUIDelete()

Thank you.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...