Open & close revBrowser

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
pattilabomba
Posts: 1
Joined: Mon Jun 09, 2014 6:11 pm

Open & close revBrowser

Post by pattilabomba » Mon Jun 09, 2014 11:21 pm

Hi there,

I'm still a complete newbie with livecode. Well, I want to create a card with a button that makes the revBrowser load a web page into a rectangle. Then I'd like to make a second button to close the revBrowser again und delete the cache.
I got the first button to work:

Code: Select all

on mouseUp
       put "http:/..." into myUrl
       put the windowID of this stack into myID
      put revBrowserOpen(myID,"") into gBrowserID
      revBrowserSet gBrowserId, "rect", rect of graphic "browser"
      revBrowserSet gBrowserID,"url",myUrl
      revBrowserSet gBrowserID,"visible",true
end mouseUp
That works so far, but I can't make the second button close that revBrowser again. When I put revbrowserclose gBrowserID in the code it always says unknown browser id. Maybe you guys know how I can make the button close the browser again.

Thanks,
Patrick

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

Re: Open & close revBrowser

Post by Simon » Mon Jun 09, 2014 11:41 pm

Hi Patrick,
Have you declared "gBrowserID"?

Code: Select all

global gBrowserID
on mouseUp
put "http:/..." into myUrl
etc.

Code: Select all

global gBrowserID
on mouseUp
revbrowserclose gBrowserID
You have to do it in both buttons.

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

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Open & close revBrowser

Post by DavJans » Wed Nov 25, 2015 8:01 pm

What if you opened a second browser with a new ID, how do you manually get rid of the browser you lost the ID to?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

James Little
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 47
Joined: Thu Apr 27, 2006 11:19 pm

Re: Open & close revBrowser

Post by James Little » Sat Nov 28, 2015 5:43 pm

See revBrowserInstances in dictionary.

Code: Select all

local tInstances, tInstance

put revBrowserInstances() into tInstances

repeat for each item tInstance in tInstances
  revBrowserClose tInstance
end repeat


Post Reply