Browsers

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
cusingerBUSCw5N
Posts: 318
Joined: Wed Jul 11, 2012 9:24 pm

Browsers

Post by cusingerBUSCw5N » Fri Dec 15, 2017 1:05 am

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
Attachments
resultstest.zip
(177.6 KiB) Downloaded 4 times

cusingerBUSCw5N
Posts: 318
Joined: Wed Jul 11, 2012 9:24 pm

Re: Browsers

Post by cusingerBUSCw5N » Fri Dec 15, 2017 1:10 am

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

cusingerBUSCw5N
Posts: 318
Joined: Wed Jul 11, 2012 9:24 pm

Re: Browsers

Post by cusingerBUSCw5N » Fri Dec 15, 2017 1:30 am

it worked...I was missing a LOT of code

bogs
Posts: 1153
Joined: Sat Feb 25, 2017 10:45 pm

Re: Browsers

Post by bogs » Fri Dec 15, 2017 6:06 am

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:
ImageImage

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5076
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Browsers

Post by dunbarx » Fri Dec 15, 2017 3:58 pm

Bogs:

:D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”