Page 1 of 1

Show/Hide not working

Posted: Wed Apr 09, 2014 9:43 pm
by roddy
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

Posted: Wed Apr 09, 2014 10:45 pm
by bangkok
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

Code: Select all

on closecard

end closecard

Re: Show/Hide not working

Posted: Wed Apr 09, 2014 10:48 pm
by Dixie
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 ?..

Re: Show/Hide not working

Posted: Wed Apr 09, 2014 11:32 pm
by Simon
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

Code: Select all

if x >= 400 then 
put 0 into x
I take it you've added the "show scrollbar..."?

Simon

Re: Show/Hide not working

Posted: Thu Apr 10, 2014 3:53 pm
by roddy
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.

Re: Show/Hide not working

Posted: Thu Apr 10, 2014 4:06 pm
by bangkok
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

Code: Select all

on closecard
   set the mgValue of group "splashScrollbar" to 0
end close card
Watch out : "closecard" without space

Code: Select all

on closecard
   set the mgValue of group "splashScrollbar" to 0
end closecard

Re: Show/Hide not working

Posted: Thu Apr 10, 2014 4:55 pm
by roddy
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

Posted: Thu Apr 10, 2014 7:37 pm
by bangkok
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...
That's the logic. You add 1 to "something"... but you didn't give a value to this "something" to start... hence the problem.
:)

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

Re: Show/Hide not working

Posted: Thu Apr 10, 2014 9:20 pm
by Simon
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