maps

Maps

You can display maps in a browser window in LiveCode. If you want to do this in a desktop environment, use the revBrowser external. If you want to use a mobile environment, use the mobileControlCreate command. You can build your URL by script and load that in a browser, e.g. to show Amsterdam in the top half of a card on a mobile device, use this syntax:


put "Amsterdam" into myCity

put "http://maps.google.nl/maps?q=" & myCity into myUrl

mobileControlCreate "browser"

put the result into gBrowserID

mobileControlSet gBrowserID,"url",myUrl

put the rect of this cd into myRect

put round(item 4 of myRect / 2) into item 4 of myRect

mobileControlSet gBrowserID,"rect",myRect

mobileControlSet gBrowserID,"visible","true"


or use this do display a browser in rect 32,32,288,288 on a desktop device:


put "Amsterdam" into myCity

put "http://maps.google.nl/maps?q=" & myCity into myUrl

put the windowID of this stack into myID

put revBrowserOpen(myID,"") into gBrowserID

revBrowserSet gBrowserID,"rect","32,32,288,288"

revBrowserSet gBrowserID,"url",myUrl

revBrowserSet gBrowserID,"visible",true


Note that gBrowserID is a global variable and needs to be declared as such.
Comments