hiding/showing a browser

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
roddy
Posts: 40
Joined: Tue Mar 04, 2014 7:24 pm

hiding/showing a browser

Post by roddy » Thu Apr 17, 2014 3:13 am

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...

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

Re: hiding/showing a browser

Post by Simon » Thu Apr 17, 2014 3:19 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

roddy
Posts: 40
Joined: Tue Mar 04, 2014 7:24 pm

Re: hiding/showing a browser

Post by roddy » Thu Apr 17, 2014 3:34 am

I get the error: (Handler: can't find handler)

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

Re: hiding/showing a browser

Post by Simon » Thu Apr 17, 2014 4:34 am

Change sBrowserId to a global and in the button add

global sBrowserId
on mouseUp
mobileControlDelete sBrowserId
blah
blah

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

roddy
Posts: 40
Joined: Tue Mar 04, 2014 7:24 pm

Re: hiding/showing a browser

Post by roddy » Thu Apr 17, 2014 5:59 am

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:

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: hiding/showing a browser

Post by Dixie » Thu Apr 17, 2014 8:08 am

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

roddy
Posts: 40
Joined: Tue Mar 04, 2014 7:24 pm

Re: hiding/showing a browser

Post by roddy » Thu Apr 17, 2014 5:06 pm

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...

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”