Page 1 of 1

hiding/showing a browser

Posted: Thu Apr 17, 2014 3:13 am
by roddy
Hello,

I created my browser in the card script:

Code: Select all

local sBrowserId

on preOpenCard
   hide fld "galleryText"
   hide group "panoramaButton"
   show group "browser"
   show group "galleryInfoButton"
   
       if the environment is not "mobile" then
              exit preOpenCard
       end if
   
       mobileControlCreate "Browser"
       put the result into sBrowserId
   
   local tURL
   put ("file:" & specialFolderPath("engine") & "/assets/pano/dream/dream.html") into tURL
   replace space with "%20" in tURL
   
       mobileControlSet sBrowserId, "rect", the rect of group "Browser"
       mobileControlSet sBrowserId, "visible", "true"
       mobileControlSet sBrowserId, "autofit", "true"
       mobileControlSet sBrowserId, "url", tURL
end preOpenCard

on closeCard
    if the environment is not "mobile" then
        exit closeCard
    end if

    mobileControlDelete sBrowserId
end closeCard
And a button to hide it and show some text in it's place:

Code: Select all

on mouseUp
   lock screen for visual effect
   show fld "galleryText"
   hide group "browser"
   hide group "galleryInfoButton"
   show group "panoramaButton"
   unlock screen with visual effect dissolve
end mouseUp
The browser goes away but then immediately comes back in front of my text field...

Re: hiding/showing a browser

Posted: Thu Apr 17, 2014 3:19 am
by Simon
The browser object sits on to of everything else.
All the time.

You might be able to get a substack to show up on top of it.

Try putting that "mobileControlDelete sBrowserId" into the mouseUp.

Simon

Re: hiding/showing a browser

Posted: Thu Apr 17, 2014 3:34 am
by roddy
I get the error: (Handler: can't find handler)

Re: hiding/showing a browser

Posted: Thu Apr 17, 2014 4:34 am
by Simon
Change sBrowserId to a global and in the button add

global sBrowserId
on mouseUp
mobileControlDelete sBrowserId
blah
blah

Simon

Re: hiding/showing a browser

Posted: Thu Apr 17, 2014 5:59 am
by roddy
Thanks, I will look at that.

In the meantime, I'm feeling pretty brilliant (just for a moment).

I put in the button:

Code: Select all

on mouseUp
   goKillBrowser
end mouseUp
And back on the card script:

Code: Select all

on goKillBrowser
    if the environment is not "mobile" then
        exit goKillBrowser
    end if
    mobileControlDelete sBrowserId
end goKillBrowser
Hey, I actually figured something out! Thanks again for your help! :lol:

Re: hiding/showing a browser

Posted: Thu Apr 17, 2014 8:08 am
by Dixie
You don't have to delete it... You can just make it invisible until you need it again

Code: Select all

   mobileControlSet browserID, "visible", false

Re: hiding/showing a browser

Posted: Thu Apr 17, 2014 5:06 pm
by roddy
Dixie wrote:You don't have to delete it... You can just make it invisible until you need it again

Code: Select all

   mobileControlSet browserID, "visible", false
I couldn't get that to work in my button script. I kept getting a Missing Handler error...