> Two ways work:
>
> 1) Make your animation a state machine driven by nilEvents from the
system,
> and have the main event loop call EvtGetEvent with a timeout of (0) while
> you're drawing to have it return immediately with a nilEvent if there are
> no pending events.
>
> 2) Put a copy of the event loop in your animation loop, doing the same
> thing as above, but without returning up through your code.
>
>
> -- Ben Combee, DTS technical lead, PalmSource, Inc.
> Read "Combee on Palm OS" at http://palmos.combee.net/
>
>
>
Thank you for the answer, I had started with 2) but I ran in the following
problem:
the copy of the event loop I used is simplified and it looks like this:
Boolean delayAndHandleEvents(Int32 iDelay)
{
EventType lEvent;
Err error;
Boolean lStop = false;
for(;;)
{
EvtGetEvent(&lEvent, 0);
if (lEvent.eType == nilEvent)
break;
else
if(! SysHandleEvent(&lEvent))
if (FrmDispatchEvent(&lEvent))
lStop = true;
}
if (!lStop)
SysTaskDelay(iDelay);
return lStop;
}
I rely on the handler for some buttons (only one button for now but several
in the future) on the current
form to set a static variable to false which will stop the animation.
This works fine under the emulator and os 4.0 but under the simulator the
events are not generated the same way:
penDown and penUp are generated
but not ctlEnter and ctlSelect.
Can you tell me why?
Best regards
Benoit
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/