Page 1 of 1

Open & close revBrowser

Posted: Mon Jun 09, 2014 11:21 pm
by pattilabomba
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

Re: Open & close revBrowser

Posted: Mon Jun 09, 2014 11:41 pm
by Simon
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

Re: Open & close revBrowser

Posted: Wed Nov 25, 2015 8:01 pm
by DavJans
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?

Re: Open & close revBrowser

Posted: Sat Nov 28, 2015 5:43 pm
by James Little
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