Here's what I wrote when Ravindra emailed me this same question:

You need to use a timeout in your EvtGetEvent call (in your event loop)
rather than SysTaskDelay. This has been discussed extensively on
palm-dev-forum. Search the archives and the Knowledge Base for "animation",
"EvtGetEvent", or "nilEvent".


You'll need a global UInt32 to contain the time to advance to the next frame
(or, in your case, scroll the text). You can use the value 0xFFFFFFFF (ie.
-1) as a special value to indicate that you aren't animating. Your event
loop checks for this value, and calls EvtGetEvent with evtWaitForever in
this case. Otherwise, it computes the delay by subtracting TimGetTicks()
from the global's value. If this would be negative (check before
subtracting), then use zero for the delay. Be sure to grab the value of
TimGetTicks once, since it's subject to change at any time. In your event
handler, you have two choices. Most people add a nilEvent case, and check if
TimGetTicks() is >= the global's value (and that the global isn't -1). You
can do this check for every event if you prefer. In either case, once the
time has come, you advance the animation (or scroll in your case) and set
the global ahead by the appropriate amount (relative to its previous value,
not the current time) depending on the animation/scroll speed.


Do not assume that just because you got a nilEvent that the animation should
be advanced. Palm OS uses nilEvents internally.


Checking the archives...


Hey! You already posted this question to the forum too. Oh well. If you
search the archives for SysTaskDelay, you'll find this answer to your
question: http://www.escribe.com/computing/pcpqa/m43034.html
--
Danny

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to