I have a Google map with markers in a browser object in an iOS app and I want to be able to click on the markers and have them pass their marker title to Livecode.
I dynamically create markers in a repeat loop from Livecode:
Code: Select all
      put specialFolderPath("engine") & "/billboards.csv" into pathToFile
      put url ("file:" & pathToFile) into tContents
      put 1 into i
      repeat for each line tLine in tContents
         put item 14 of tLine into lat
         put item 13 of tLine into lng
         put item 18 of tLine into titleName 
          // Call Javascript function within the loaded map HTML page
         MobileControlDo browserID, "execute", ("setMarkerAt(" && lat & "," & lng & "," & i & ")")
         add 1 to i
      end repeat
Code: Select all
function setMarkerAt(lat, lng, i){
var markerPos=new google.maps.LatLng(lat, lng);
var titleName = i.toString() //i is just an index number to identify markers when clicked using marker.getTitle()
var marker=new google.maps.Marker({
  position:markerPos,
  map:map,
  title:titleName
  });
  marker.setMap(map);
  marker.addListener('click', function() {
  window.alert(marker.getTitle());
  });
}
I'm not sure to how to actually do this (possible?) or how to ask Google. Any help in this really appreciated. Thanks.
Kind regards, Paul.
