problem with the card and the Browser
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 20
- Joined: Tue Mar 01, 2011 11:23 pm
problem with the card and the Browser
Hello, I just put a browser on a Card2 but when I put a button back on a card1, the browser still appears on the card1, how it should not appear on card1?
Re: problem with the card and the Browser
Hi James,
a "browser" object is always an OVERLAY on the screen and not a "real" LiveCode object.
This way this object will always be on the screen, does not care about stacks and cards
and will leave the responsibility to YOU, the developer
You will need to hide or close (delete) the browser when switching cards/stacks!
Check menu: Help -> iOS Release Notes
to get more info about "iOS Native Controls"
Best
Klaus
a "browser" object is always an OVERLAY on the screen and not a "real" LiveCode object.
This way this object will always be on the screen, does not care about stacks and cards
and will leave the responsibility to YOU, the developer

You will need to hide or close (delete) the browser when switching cards/stacks!
Check menu: Help -> iOS Release Notes
to get more info about "iOS Native Controls"
Best
Klaus
-
- Posts: 20
- Joined: Tue Mar 01, 2011 11:23 pm
Re: problem with the card and the Browser
thank you for your quick answer, but I'm sorry I'm newbie, and how to hide or does your close (delete) the Browser ....
thank you in advance
thank you in advance
Re: problem with the card and the Browser
Hi James,
newbie or not, as I wrote in my last mail, you can find the answer in teh LiveCode menus!
Check menu: Help -> iOS Release Notes
to get more info about "iOS Native Controls"
EDIT:
Here some nore hints:
...
## Delete the iOS object:
iphoneControlDelete id
...
## Change its visibility:
iphoneControlSet id, "visible", false
...
Best
Klaus
newbie or not, as I wrote in my last mail, you can find the answer in teh LiveCode menus!
Check menu: Help -> iOS Release Notes
to get more info about "iOS Native Controls"
EDIT:
Here some nore hints:
...
## Delete the iOS object:
iphoneControlDelete id
...
## Change its visibility:
iphoneControlSet id, "visible", false
...
Best
Klaus
-
- Posts: 20
- Joined: Tue Mar 01, 2011 11:23 pm
Re: problem with the card and the Browser
I created a button function as return, and I have write code like "iphoneControlDelete isBrowserId" and its not working ... I do not understand ...
Re: problem with the card and the Browser
Hi James,
please post the script(s) that you use to CREATE the browser on iOS!
You may need to declare the object ID as a global variable to be able
to use it with "iPhonedelete ID" or "iphoneControlSet id,..."
Best
Klaus
please post the script(s) that you use to CREATE the browser on iOS!
You may need to declare the object ID as a global variable to be able
to use it with "iPhonedelete ID" or "iphoneControlSet id,..."
Best
Klaus
-
- Posts: 20
- Joined: Tue Mar 01, 2011 11:23 pm
Re: problem with the card and the Browser
the code of the cards of browser :
# declare the local id of the browser we are creating
global sBrowserId
# when the card is opened make sure that default settings are configured
on preOpenCard
# quit if we are not on a mobile device
if the environment is not "mobile" then
exit preOpenCard
end if
# create the browser
iphoneControlCreate "browser"
put the result into sBrowserId
# set up the basic defaults
iphoneControlSet sBrowserId, "rect", the rect of group "Browser"
iphoneControlSet sBrowserId, "visible", "true"
iphoneControlSet sBrowserId, "url", "url-of-google-example"
end preOpenCard
on closeCard
if the environment is not "mobile" then
exit closeCard
end if
# destroy the browser we created
iphoneControlDestroy sBrowserId
iphoneControlDelete sBrowserId
end closeCard
# provide a status message that indicates loading has started
on browserStartedLoading pUrl
put "Started loading:" && pUrl into field "Status"
end browserStartedLoading
# provide a status message that indicates loading has finished
on browserFinishedLoading pUrl
put "Finished loading:" && pUrl into field "Status"
put pUrl into field "Url"
end browserFinishedLoading
# provides a status message that indicates the reason for loading
on browserLoadRequest pUrl
answer "Do you want to load:" && pUrl with "Yes" and "No"
if it is "Yes" then
pass browserLoadRequest
else
put "Refused:" && pUrl into field "Status"
end if
end browserLoadRequest
# a handler that executes an action invoked by the controls
on doAction pAction
iphoneControlDo sBrowserId, pAction
end doAction
# a handler that loads the URL
on goUrl pUrl
iphoneControlSet sBrowserId, "url", pUrl
end goUrl
and i have a create a button with this code :
on mouseUp
iphoneControlDelete sBrowserId
#iphoneControlSet sBrowserId, "visible", false
end mouseUp
its still not working ...
# declare the local id of the browser we are creating
global sBrowserId
# when the card is opened make sure that default settings are configured
on preOpenCard
# quit if we are not on a mobile device
if the environment is not "mobile" then
exit preOpenCard
end if
# create the browser
iphoneControlCreate "browser"
put the result into sBrowserId
# set up the basic defaults
iphoneControlSet sBrowserId, "rect", the rect of group "Browser"
iphoneControlSet sBrowserId, "visible", "true"
iphoneControlSet sBrowserId, "url", "url-of-google-example"
end preOpenCard
on closeCard
if the environment is not "mobile" then
exit closeCard
end if
# destroy the browser we created
iphoneControlDestroy sBrowserId
iphoneControlDelete sBrowserId
end closeCard
# provide a status message that indicates loading has started
on browserStartedLoading pUrl
put "Started loading:" && pUrl into field "Status"
end browserStartedLoading
# provide a status message that indicates loading has finished
on browserFinishedLoading pUrl
put "Finished loading:" && pUrl into field "Status"
put pUrl into field "Url"
end browserFinishedLoading
# provides a status message that indicates the reason for loading
on browserLoadRequest pUrl
answer "Do you want to load:" && pUrl with "Yes" and "No"
if it is "Yes" then
pass browserLoadRequest
else
put "Refused:" && pUrl into field "Status"
end if
end browserLoadRequest
# a handler that executes an action invoked by the controls
on doAction pAction
iphoneControlDo sBrowserId, pAction
end doAction
# a handler that loads the URL
on goUrl pUrl
iphoneControlSet sBrowserId, "url", pUrl
end goUrl
and i have a create a button with this code :
on mouseUp
iphoneControlDelete sBrowserId
#iphoneControlSet sBrowserId, "visible", false
end mouseUp
its still not working ...
Re: problem with the card and the Browser
Hi James,
the problem is the ID that you get when you initialize (create new) browser control.
It IS already declared as a global variable, but you need to declare it every time in every
scripts/handlers you use this variable!
Do this:
That should do the trick!
Please check all these stacks here to get the basics of LiveCode:
http://www.runrev.com/developers/lesson ... nferences/
Best
Klaus
the problem is the ID that you get when you initialize (create new) browser control.
It IS already declared as a global variable, but you need to declare it every time in every
scripts/handlers you use this variable!
Do this:
Code: Select all
on mouseUp
GLOBAL sBrowserId
iphoneControlDelete sBrowserId
end mouseUp
Please check all these stacks here to get the basics of LiveCode:
http://www.runrev.com/developers/lesson ... nferences/
Best
Klaus
-
- Posts: 20
- Joined: Tue Mar 01, 2011 11:23 pm
Re: problem with the card and the Browser
Thank you a thousand times, Klaus, you helped me, and it works nikel ... Sincerely, James