> As it appears to me, 
> its value is just ignored, so I get PrgCallbackDataPtr->timedOut = 1 
> immediately on next PrgHandleEvent.

In my own code, I've implemented an animating icon in the Progress Manager
without using the Progress Manager's timeout feature. I used actual
throughput to drive the animation, rather than time: the animation advances
one frame for every 3 packets sent or received over the IrLMP connection.

The built-in IrOBEX exchange library uses the timeout feature for animation.

> I just want to get spinning 
> bitmap there, turning every second, so I set timeout = 
> SysTicsPerSecond() whenever I get timedOut = 1.

You should set timeout to TimGetTicks() + SysTicksPerSecond(), or whatever
the inter-frame delay in your animation is.

> Instead of desired effect, bitmap rotation speed depends only on value 
> of timeout parameter passed to EvtGetEvent in the eventLoop - it's spins 
> too quick on smaller values - I even see stroboscope-like effect for 
> very small ones. ;)

Cute! I don't think the Progress Manager's timeout feature will work if you
pass evtWaitForever to EvtGetEvent. You can pass a suitable small constant
(as in the code you posted), or you can compute the delay for the next
animation frame. Passing PrgHandleEvent the nilEvent you get when
EvtGetEvent times out will cause the Progress Manager to check if the
timeout has been reached, and if it has, it'll set the timedOut flag. Your
callback will take this as its cue to advance the animation, setting the
timeout ahead for the next frame.

>          inDataP->timeout = SysTicksPerSecond();

As I said, you need to add your inter-frame animation period to the current
time, in ticks.

The structure of the IrOBEX exchange library progress callback is something
like this:

if (cbP->timedOut && cbP->bitmapId != idle bitmap)
{
        cbP->bitmapId = next frame after cbP->bitmapId;
        cbP->textChanged = false;
        cbP->timeout = TimGetTicks() + SysTicksPerSecond();
        return true;
}
if (cbP->error = user cancel)
{
        cbP->error = errNone;
        cbP->canceled = true;
}
if (cbP->canceled && cbP->error == errNone)
{
        put "canceling" message in cbP->textP;
        cbP->bitmapId = idle bitmap;
}
else if (cbP->error)
{
        put error message in cbP->textP;
        cbP->bitmapId = error bitmap;
}
else
{
        cbP->bitmapId = idle bitmap; // default
        cbP->timeout = 0; // default
        put default message in cbP->textP;
        switch (cbP->stage)
        {
                case some normal stage:
                        cbP->bitmapId = some bitmap; // first frame in
animation
                        put some message in cbP->textP;
                        cbP->timeout = TimGetTicks() + SysTicksPerSecond();
// start animation
                        break;
                case disconnecting stage:
                        cbP->bitmapId = idle bitmap;
                        cbP->canceled = true; // get rid of OK button
                        put some message in cbP->textP;
                        break;
                case interrupted stage:
                        cbP->bitmapId = idle bitmap;
                        cbP->canceled = false; // restore OK button
                        put some message in cbP->textP;
                        break;
                ...
        }
}
return true;
--
Danny @ PalmSource

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

Reply via email to