Show/Hide not working
Moderators: LCNeil, heatherlaine, kevinmiller, elanorb
Show/Hide not working
Hello - I'm showing/hiding progress bar and start button with on preopencard in the card script but it only works the first time I open the stack. If I navigate back to the splash card it doesn't reset... my stack is 1.1mb and forum won't let me upload. How can I get it to you?
Re: Show/Hide not working
Copy here your script so we can have a look.
I think there is some confusion : if you want object appearance to change when you leave the card ("If I navigate back to the splash card it doesn't reset") then you have to use
I think there is some confusion : if you want object appearance to change when you leave the card ("If I navigate back to the splash card it doesn't reset") then you have to use
Code: Select all
on closecard
end closecard
-
- Livecode Opensource Backer
- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
- Location: Bordeaux, France
Re: Show/Hide not working
explain a little more... should the progress bar & button show when your stack first opens ?.. Should it then be hidden when you return to the first card ?..
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Show/Hide not working
Hi roddy,
If you are refering to this:
http://forums.runrev.com/phpBB2/viewtop ... 53#p101003
Then you have to reset x back to 0
I take it you've added the "show scrollbar..."?
Simon
If you are refering to this:
http://forums.runrev.com/phpBB2/viewtop ... 53#p101003
Then you have to reset x back to 0
Code: Select all
if x >= 400 then
put 0 into x
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Show/Hide not working
Thanks for the responses.
Here is my card script on my splash card (card 1):
on preopencard
hide button "start"
show group "splashScrollbar"
show fld "load"
set the mgValue of control "splashScrollbar" to 0
goScroll
end preopencard
local x
on goScroll
add 1 to x
if x >= 400 then
lock screen for visual effect
hide group "splashScrollbar"
hide field "load"
show button "start"
unlock screen with visual effect dissolve
exit goScroll
end if
set the mgValue of group "splashScrollbar" to x/4
send goScroll to me in 10 millisec
end goScroll
on closecard
set the mgValue of group "splashScrollbar" to 0
end close card
--
This works the first time I open the stack in LC and in the simulator. But, if I navigate back to card 1 in LC it doesn't. Also, I have to quit LC and restart to get it to work, if I just close and open the stack, it opens to the splash screen with the start button showing and the progress scroll bar is hidden.
Here is my card script on my splash card (card 1):
on preopencard
hide button "start"
show group "splashScrollbar"
show fld "load"
set the mgValue of control "splashScrollbar" to 0
goScroll
end preopencard
local x
on goScroll
add 1 to x
if x >= 400 then
lock screen for visual effect
hide group "splashScrollbar"
hide field "load"
show button "start"
unlock screen with visual effect dissolve
exit goScroll
end if
set the mgValue of group "splashScrollbar" to x/4
send goScroll to me in 10 millisec
end goScroll
on closecard
set the mgValue of group "splashScrollbar" to 0
end close card
--
This works the first time I open the stack in LC and in the simulator. But, if I navigate back to card 1 in LC it doesn't. Also, I have to quit LC and restart to get it to work, if I just close and open the stack, it opens to the splash screen with the start button showing and the progress scroll bar is hidden.
Re: Show/Hide not working
Add
put 1 into x
Watch out : "closecard" without space
put 1 into x
Code: Select all
local x
on preopencard
put 1 into x
hide button "start"
show group "splashScrollbar"
show fld "load"
set the mgValue of control "splashScrollbar" to 0
goScroll
end preopencard
Code: Select all
on closecard
set the mgValue of group "splashScrollbar" to 0
end close card
Code: Select all
on closecard
set the mgValue of group "splashScrollbar" to 0
end closecard
Re: Show/Hide not working
Thanks, that works, but I have no idea why. How does "put 1 into x" cause my show/hide commands to start working? Also, now the scrollbar take about 20 seconds in LC to complete but works correctly (4 seconds) in the simulator...
bangkok wrote:Add
put 1 into x
Code: Select all
local x on preopencard put 1 into x hide button "start" show group "splashScrollbar" show fld "load" set the mgValue of control "splashScrollbar" to 0 goScroll end preopencard
Re: Show/Hide not working
That's the logic. You add 1 to "something"... but you didn't give a value to this "something" to start... hence the problem.roddy wrote:Thanks, that works, but I have no idea why. How does "put 1 into x" cause my show/hide commands to start working? Also, now the scrollbar take about 20 seconds in LC to complete but works correctly (4 seconds) in the simulator...
But I still think that you overshoot the script, just to show / hide with a group a visual effect.
One line should be enough. For instance :
Code: Select all
hide button "start"
show fld "load"
show grp "splashScrollbar" with visual effect iris open slowly
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Show/Hide not working
Hi roddy,
Do you know how to use breakpoints?
After you run that script the first time x >= 400 and it remains that way. Go to the beach and come back, as long as you didn't shut the app down x >= 400. Have lunch, take the dog out for a walk x>=400.
So you have to reset it, put 0 into x.
Simon
Do you know how to use breakpoints?
After you run that script the first time x >= 400 and it remains that way. Go to the beach and come back, as long as you didn't shut the app down x >= 400. Have lunch, take the dog out for a walk x>=400.
So you have to reset it, put 0 into x.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!