Page 1 of 1

Opening card not displaying in Simulator

Posted: Mon Jan 28, 2013 5:19 am
by jstarkman
Hi all,

I have an app in which card 1 does not display when run in the simulator or on the device. I can go to card 2 and then back to card 1 just fine, and I can get card 2 to display as the first card (using "go card 2" in openstack), but for some reason, card 1 does not like to be first. Any ideas what's happening?

Joel

Re: Opening card not displaying in Simulator

Posted: Mon Jan 28, 2013 2:22 pm
by Mark
Hi Joel,

Do you have any scripts that run automatically when the stack opens? Does the first card appear if you disable all these scripts?

Kind regards,

Mark

Re: Opening card not displaying in Simulator

Posted: Tue Jan 29, 2013 4:17 am
by jstarkman
Hi Mark,

Thanks for your response. I have disabled all stack scripts (preOpenStack and openStack). The problem seems to be in the openCard handler for Card 1.

In an effort to solve this problem, I have created a new stack with only two cards. Card 1 has a single field. Card 2 has a single button with a mouseUp handler to go to Card 1. This is the script:

on preOpenCard
set the visible of fld "start" to false
set the text of fld "start" to "Start"
end preOpenCard

on openCard
local tCount

wait 1 second
set the effectrate to 1000
set the text of fld "start" to "Starting"
show fld "start" with visual effect "dissolve very slow"

repeat with tCount = 1 to 5
wait 500 milliseconds
set the text of fld "start" to the text of fld "start" & "."
end repeat

set the effectrate to 1000
lock screen for visual effect
go card 2
unlock screen with visual effect "dissolve very slow"

end openCard


It runs fine in the IDE. But on the simulator, Card 1 is completely black for the expected duration, and then Card 2 comes up. All functions properly from there on in. Card 1 behaves as expected, and so on.

I'm running LC 5.5.1. and building for iOS 5.0.

Regards,

Joel

Re: Opening card not displaying in Simulator

Posted: Tue Jan 29, 2013 4:53 am
by Simon
It sounds like visual effect doesn't work on a device.
Try setting the blendLevel instead.

repeat with x = 100 down to 1
set the blendLevel of fld "start" to x
wait 10 milliseconds with messages --may need this or not
end repeat

Simon

Re: Opening card not displaying in Simulator

Posted: Tue Jan 29, 2013 3:07 pm
by jstarkman
Hi Simon,

I wish that was the problem, but it's not. The "visual effect" seems to work fine, as is demonstrated when opening Card 1 from Card 2 (button "Go Card 1"). Revising the code using blendLevel instead does not resolve this problem.

I think I've narrowed it down to this:
If I have "go card 2" in the openCard handler of card 1, the app will not display card 1, but will go to card 2 at the appropriate time, e.g. processing is happening but not visible. I can then navigate back to card 1 in the app and all is properly displayed. A bit more testing is required, e.g. I want to verify that adding a button on card 1 to get to card 2 works.

Seems like a bug to me.

Joel

Re: Opening card not displaying in Simulator

Posted: Tue Jan 29, 2013 4:25 pm
by jmburnod
Hi,

It seem that is better with a send in time command, but the "dots adding" are not visible
Did you test it on device ?

Code: Select all

on preOpenCard
set the visible of fld "start" to false
set the text of fld "start" to "Start"
end preOpenCard

on openCard
   local tCount
   wait 1 second
   set the effectrate to 1000
   set the text of fld "start" to "Starting"
   show fld "start" with visual effect "dissolve very slow"
   repeat with tCount = 1 to 5
      wait 500 milliseconds
      set the text of fld "start" to the text of fld "start" & "."
   end repeat
 set the effectrate to 1000
   lock screen for visual effect
    --•• jmb
   send Gocard2 to me  in 500 milliseconds 
   --go card 2
 --unlock screen with visual effect "dissolve very slow"
end openCard

on Gocard2
   lock screen for visual effect
   go card 2
   unlock screen with visual effect "dissolve very slow"
end Gocard2
Best regards
Jean-Marc

Re: Opening card not displaying in Simulator

Posted: Wed Jan 30, 2013 5:17 am
by jstarkman
All,

Thanks for your continued efforts... But it still isn't working. When I run the following script on the simulator, the screen is blank for 5 seconds, then card 2 is displayed. I can navigate back to card 1 with a button on card 2, and then after 5 seconds will be sent back to card 2 with the gocard2 handler. But the problem remains: card 1 is a blank screen when the stack first opens.

I've revised the code to be in the following extremely basic form in a new mainstack with only two cards. The mainstack has the following script in the card 1 script:

Code: Select all

on openCard
   lock screen
   unlock screen
   wait 5 seconds with messages
   send gocard2 to me in 500 milliseconds
end openCard

on gocard2
   go card 2
end gocard2
Can somebody try this on their machines and let me know if it's working for you? I'm using a MacBook running Snow Leopard, LC 5.5.1. and building for iOS 5.0.

Thanks,

Joel

Re: Opening card not displaying in Simulator

Posted: Wed Jan 30, 2013 9:46 am
by jmburnod
Hi Joel,

OSX 10.6.8, LC 5.02 make this result
1. 5 seconds blank
2. Cd 1 appear
3. Cd 2 is open after 500 milliseconds
It seem simulator don't work like device. Did you test your script on device ?

Best regards

Jean-Marc

Re: Opening card not displaying in Simulator

Posted: Wed Jan 30, 2013 10:30 am
by Dixie
Hi...

This works in the iphone simulator... the first card is visible immediately on launch and then after 5 secs goes to card 2>..:-)

Code: Select all

on openCard
   --lock screen
   --unlock screen
   --wait 5 seconds with messages
   send gocard2 to me in 5000 milliseconds
end openCard

on gocard2
   go card 2
end gocard2
I don't understand your use of lock screen ...

Dixie

Re: Opening card not displaying in Simulator

Posted: Wed Jan 30, 2013 2:47 pm
by jstarkman
Hi Dixie,

In some other testing, the use of lock/unlock generate a screen draw for me. After your post I tried again. It seems to work if you leave lock/unlock in, but comment out the "wait 5 seconds with messages" remark. I've also noticed "wait" in a repeat loop seems to cause problems. Not sure why, and maybe someone can explain this. What is the best way to create a pause in a loop?

Hi Jean-Marc,

I'll try on the device and report back.

Thanks.

Joel

Re: Opening card not displaying in Simulator

Posted: Wed Jan 30, 2013 4:31 pm
by jmburnod
Hi Joel,
What is the best way to create a pause in a loop?
Here is a stack with a kind of timer for 5 seconds (but it is not an exemple of swiss precisions, the result should be between 5000 and 5015 milliseconds :oops:
Best regards
Jean-Marc

Re: Opening card not displaying in Simulator

Posted: Mon Nov 09, 2015 6:45 am
by gregmiller
Did you ever get a good solution to this problem? I have the exact same problem and it does seem to be related to "wait". I downloaded the time pending loop example and get it. But, it seems like "wait" should not cause this problem and there is a simpler solution I have not figured out yet.

Thanks.