2016년 12월 10일 토요일

Wait or delay method fail


A common request is a 'wait' block to cause a delay in the app.
What is usually recommended is a Clock Timer event block to delay for the amount of time required.

The attached snippet attempts to simplify this by eliminating the Timer event block and the global variables usually required.
It uses an existing Clock instance in the app.
Upon cursory examination it appears to work as the delay happens as expected.
However, the blocks before the delay procedure will not execute as explained by Taifun's analysis in this thread.
So follow his recommendations in this thread which use a Clock Timer event block.
 delaynew.png
--
What is usually recommended is a Clock Timer event block to delay for the amount of time required.
yes, exactly, the reason is to not block the device, this is also explained here 



but why are you using an advanced clock block?
you also could have done it like this
--
my recommendation is to use Scott's "Please Wait" solution, which uses a clock component to wait for several seconds without blocking the device here https://groups.google.com/d/msg/mitappinventortest/m8i32I2m200/-cz21HLcvv4J
--
Let's make this a counter-example, then.
I should have used your blocks for testing output before the delay.
My focus was on getting the delay to work with fewer blocks.
I should have known better and forgot about the posts that you cited which are simple enough.

--

댓글 없음:

댓글 쓰기