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
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode