B bryanh Member Licensed User Longtime User Dec 1, 2012 #1 Hi, I can show a number of markers indicating where photos were taken using the code: B4X: For i = 0 to numphotos, .. HtmlCode = HtmlCode & "; var marker = new google.maps.Marker({ position: new google.maps.LatLng(" & lat & "," & lon & "),map: map, clickable: true, draggable: true, icon: 'http://www.google.com/mapfiles/marker_orange.png' })" HtmlCode = HtmlCode & "; marker.setTitle('" & picfile & "')" .. Next I have set the title for each marker as the filename of the particular photo. I then wish to set up an event so that when a marker is clicked the photo is shown in an imageview. Following the above code I've added: B4X: HtmlCode = HtmlCode & "; google.maps.event.addListener(marker, 'click', function(mouseevent) {" HtmlCode = HtmlCode & "B4A.CallSub('MapViewer_MarkerClicked', marker.getTitle); })" The B4A subroutine is: B4X: Sub MapViewer_MarkerClicked(mark As String) ImageView1.Bitmap = LoadBitmap(picdir, mark) End Sub However, when I run the program and click on one of the markers I get the error message: B4X: java.lang.Exception: Sub mapviewer_markerclicked signature does not match expected signature Can anyone suggest the meaning of the error message, and how it can be avoided. Many thanks bryanh
Hi, I can show a number of markers indicating where photos were taken using the code: B4X: For i = 0 to numphotos, .. HtmlCode = HtmlCode & "; var marker = new google.maps.Marker({ position: new google.maps.LatLng(" & lat & "," & lon & "),map: map, clickable: true, draggable: true, icon: 'http://www.google.com/mapfiles/marker_orange.png' })" HtmlCode = HtmlCode & "; marker.setTitle('" & picfile & "')" .. Next I have set the title for each marker as the filename of the particular photo. I then wish to set up an event so that when a marker is clicked the photo is shown in an imageview. Following the above code I've added: B4X: HtmlCode = HtmlCode & "; google.maps.event.addListener(marker, 'click', function(mouseevent) {" HtmlCode = HtmlCode & "B4A.CallSub('MapViewer_MarkerClicked', marker.getTitle); })" The B4A subroutine is: B4X: Sub MapViewer_MarkerClicked(mark As String) ImageView1.Bitmap = LoadBitmap(picdir, mark) End Sub However, when I run the program and click on one of the markers I get the error message: B4X: java.lang.Exception: Sub mapviewer_markerclicked signature does not match expected signature Can anyone suggest the meaning of the error message, and how it can be avoided. Many thanks bryanh
warwound Expert Licensed User Longtime User Dec 1, 2012 #2 You've omitted the callUIThread parameter in your javascript. http://www.b4x.com/forum/additional...al-updates/12453-webviewextras.html#post70053 B4X: HtmlCode = HtmlCode & "; google.maps.event.addListener(marker, 'click', function(mouseevent) {" HtmlCode = HtmlCode & "B4A.CallSub('MapViewer_MarkerClicked', true, marker.getTitle); })" As your app's user interface will be modified by the CallSub you must pass javascript value true for callUIThread. Martin. Upvote 0
You've omitted the callUIThread parameter in your javascript. http://www.b4x.com/forum/additional...al-updates/12453-webviewextras.html#post70053 B4X: HtmlCode = HtmlCode & "; google.maps.event.addListener(marker, 'click', function(mouseevent) {" HtmlCode = HtmlCode & "B4A.CallSub('MapViewer_MarkerClicked', true, marker.getTitle); })" As your app's user interface will be modified by the CallSub you must pass javascript value true for callUIThread. Martin.
B bryanh Member Licensed User Longtime User Dec 1, 2012 #3 Many thanks Martin .. all going well now Bryan Upvote 0