Page 1 of 1

Browsers

Posted: Fri Dec 15, 2017 1:05 am
by cusingerBUSCw5N
I'm confused and frustrated because the script that used to work for going to a browser doesn't work on my android anymore. I'm not sure if I accidentally removed a key line of code or whether LiveCode changed.

Here is the code for the browser

Code: Select all

 global gRCBrowser, gCard
local sBrowserId

on preopencard

   resizeStack

   # quit if we are not on a mobile device
   --    if the environment is not "mobile" then
   --        exit preOpenCard
   --    end if
   
   if the environment is "mobile" then
      # create the browser

      mobileControlCreate "browser"
      put the result into sBrowserId
      
      # set up the basic defaults
      mobileControlSet sBrowserId, "rect", the rect of group "rcBrowser"
      mobileControlSet sBrowserId, "visible", "true"
      mobileControlSet sBrowserId, "url", gRCBrowser
      mobileControlSet sBrowserId, "autofit", true
  put "http://www.irs.gov" into field "devURL" 

  ///put gRCBrowser into field "devURL"
///answer gRCBrowser
   end if
Thanks for your help. I have also attached a stripped down stack. Click on the button and it goes to the browser card...but never opens the webpage.

By the way.... I have selected internet in the Standalone settings. I am testing this using Android off a Windows PC

Re: Browsers

Posted: Fri Dec 15, 2017 1:10 am
by cusingerBUSCw5N
So I have just found this and will try it:

Code: Select all

 global gRCBrowser, gCard
local sBrowserId

on preopencard

   resizeStack

   # quit if we are not on a mobile device
   --    if the environment is not "mobile" then
   --        exit preOpenCard
   --    end if
   
   if the environment is "mobile" then
      # create the browser

      mobileControlCreate "browser"
      put the result into sBrowserId
      
      # set up the basic defaults
      mobileControlSet sBrowserId, "rect", the rect of group "rcBrowser"
      mobileControlSet sBrowserId, "visible", "true"
      mobileControlSet sBrowserId, "url", gRCBrowser
      mobileControlSet sBrowserId, "autofit", true
   ///  put "https://www.readyconnect.us" into field "devURL" 

  put gRCBrowser into field "devURL"
answer gRCBrowser
   end if

Re: Browsers

Posted: Fri Dec 15, 2017 1:30 am
by cusingerBUSCw5N
it worked...I was missing a LOT of code

Re: Browsers

Posted: Fri Dec 15, 2017 6:06 am
by bogs
I think this person is going to put us out of business, in 3 posts and about 25 minutes, he solved his own question :(

Congratulations on finding the answer though :mrgreen:

Re: Browsers

Posted: Fri Dec 15, 2017 3:58 pm
by dunbarx
Bogs:

:D