You said tcoord contains the information you want to return... I don't think you need to actually include the livecode function call in your html, I'm pretty sure you can remove it entirely and do something like this..
do "liveCode.inputLoc(tcoord)" in widget "Browser" and it will work. (It did for me, its possible there are issues elsewhere in the javascript code) In this way you can define a single javascripthandler and have it hand back any data you need. As a quick example, I set the htmltext of a widget to the following.. <html> <body> <script> var tcoords='1,2,3' </script> </body></html> The ONLY thing in there as javascript is the declaration of tcoords Then from the message box I set a javascript handler to myJSHandler and then.. do "liveCode.myJSHandler(tcoords,'fred')" in widget 1 For my lc handler I used paramcount and param() to find out and show the data that was passed out. command myjshandler put empty repeat with i = 1 to the paramcount put param(i) & cr after msg end repeat end myjshandler As expected the message box displayed 1,2,3 fred You might be able to leverage this into some debugging ability. I did try a bunch of different ways to get things out (some that seemed like they SHOULD work but didn't, causing an "error eveluating javascript" error) It even seemed sometimes that a method that worked just a minute ago would stop. (I'm so bad at javascript though, its no surprise i'm lost) On Wed, Jun 15, 2016 at 10:38 AM, Jacques Hausser <jacques.haus...@unil.ch> wrote: > Still trying to use the browser widget and its javascripthandlers. I > picked information here and there (many thanks to those who answered my > previous mails, especially Mike) but really I would be glad to find a > detailed user’s guide somewhere. I’m using a html file exploiting google > map’s API as URL, and it works perfectly well with the old style browser. > But I cannot grab the information I want with the new browser widget. > Hereunder a simplified (and tested) example of what I tried for the old > browser (successfully) and the widget browser (to no avail). > > —————————————————————————————— > old style browser: > —————————————————————————————— > in the card script: > > command getLoc > get revBrowserCallScript(LBrowserID,exportXYZ) > put it into fld "FResult" > end getLoc > > in the html file: > > function exportXYZ() > //tCoord contains the ccordinates and altitude of the last point clicked > { > var vCoord = tCoord; > return vCoord; > } > —————————————————————————————— > browser widget: > —————————————————————————————— > in the card script: > > command getLoc > do "exportXYZ();" in widget "mapBrowser" > end mouseUp > > command inputLoc pCoord > —- this command’s name is in the list of javascripthandlers for my browser > put pCoord into fld "FResult" > end inputLoc > > in the html file: > > function exportXYZ() > //tCoord contains the ccordinates and altitude of the last point clicked > { > var pCoord = tCoord; > liveCode.inputLoc(pCoord); > } > —————————————————————————————— > > the html file is exactly the same in both cases except for the change > illustrated above. The map is displayed as expected in the browser widget, > I can click any location to get a marker displayed and I can move to a new > region with the following: > > —————————————————————————————— > in the card script: > > command newReg plat,plon,pzoom > do "goToReg(plat,plon,pzoom);” in widget "mapBrowser" > end mouseUp > > and in the htlm file: > > function goToReg(pLat,pLng,pZoom) > { > var newCenter = new google.maps.LatLng(pLat,pLng); > tmap.setCenter(newCenter); > var tZoom = parseInt(pZoom,10); > tmap.setZoom(tZoom); > } > —————————————————————————————— > > Thus “do … in widget” works; but I cannot fetch those damned coordinates > with “liveCode.inputLoc(pCoord);". How to make the javascriptHandlers to > work ? > > PS: Mac 10.11.5, LC 8.0.2 rc2 > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode