Mobile browser

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
saviour
Posts: 26
Joined: Wed Feb 05, 2014 5:11 am

Mobile browser

Post by saviour » Thu Feb 13, 2014 8:02 am

I will appreciate if someone could guide me on this:
mobileControlCreate "browser"
put the result into sBrowserId
mobileControlSet sBrowserId, "visible", "true"
mobileControlSet sBrowserId, "load", the yURL of this cd
resizeStack
end preOpenCard

But link do not open in the browser area. So where am I wrong here? Please help!!!!
Last edited by saviour on Fri Feb 14, 2014 5:10 am, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Mobile browser

Post by Simon » Thu Feb 13, 2014 8:12 am

Hi saviour,
I think for you the best thing would be to make a global variable.

Code: Select all

global yURL
on mouseUp
put "http://www.google.com" into yURL
go to card "card2"
end mouseUp
Then on card 2

Code: Select all

global yURL
local sBrowserId
on preOpenCard
if the environment is not "mobile" then
exit preOpenCard
end if

mobileControlCreate "browser"
put the result into sBrowserId
mobileControlSet sBrowserId, "visible", "true"
mobileControlSet sBrowserId, "load", the yURL of this cd
resizeStack
end preOpenCard
Not sure but I think you have to set the rect of sBrowserId as well which is missing.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Mobile browser

Post by Klaus » Thu Feb 13, 2014 1:23 pm

Hi all,

the ORDER of the commands is highly important!
This:

Code: Select all

on mouseUp
  go to card "card2"
  set the yURL of card "card2" to ".................."
end mouseUp
will go cause "pre-/opencard" will be executed BEFORE the cp has been set!

So this (and setting the RECT of the mobile brower!) should do the job:

Code: Select all

on mouseUp
  set the yURL of card "card2" to ".................."
  go to card "card2"
end mouseUp
@Simon
when using a global you should use it everywhere:

Code: Select all

global yURL
...
## mobileControlSet sBrowserId, "load", the yURL of this cd
mobileControlSet sBrowserId, "load", yURL
...
8)

Best

Klaus

saviour
Posts: 26
Joined: Wed Feb 05, 2014 5:11 am

Re: Mobile browser

Post by saviour » Thu Feb 13, 2014 5:36 pm

Thanks guys!! Tested it and it really worked on my Android device..

I have learnt many things from u..Appreciate that :D

Post Reply