Yes.  If any events exists before the time out, that event resets the
counting, even nilEvent.  Your event loop could use either of the following
techniques:
- Trap all events and look at the number of ticks to see if its time to
perform your operation.  (remember to allow the events to pass through to be
processed or your app will not work.)
- Set EvtGetEvent to generate a nilEvent at 2-4 times the interval of your
event.  i.e. you need to perform an event every 500ms, set the timeout to
250ms.  Trap all nilEvents, check # of ticks to trigger your event.  The
trade off here is the unit will not doze as frequently and burn the
batteries slightly faster (the average user will more than likely not notice
a difference)

I typically use the second method but will change the timeout value back to
0 when the app doesn't need the timer.

----- Original Message -----
From: "DongDong" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, July 02, 2003 2:47 AM
Subject: Question about nilEevent


> On page 949 about EvtGetEvent function in Palm  OS Reference:
>
> Prototype void EvtGetEvent (EventType *event, Int32 timeout)
>
>  "Note that a timeout value greater than or equal to zero is simply the
> maximum number of ticks which can elapse before EvtGetEvent
> returns an event. If any other event�Xincluding a nilEvent�X
> occurs before this time has elapsed, EvtGetEvent will return that
> event. Otherwise, once the specified time has elapsed
> EvtGetEvent generates and returns a nilEvent. If you supply a
> value of zero for the timeout parameter, EvtGetEvent returns the
> event currently in the queue, or, if there aren��t any events in the
> queue, it immediately generates and returns a nilEvent."
>
> From line 5:
>
> once the specified time has elapsed
> EvtGetEvent generates and returns a nilEvent.
>
> But in line 3:
>
> If any other event�Xincluding a nilEvent�X
> occurs before this time has elapsed, EvtGetEvent will return that
> event.
>
> Does it mean that 'nilEvent' can occur before timeout and also after
> timeout? Then what trigger nilEvent actually?
>
> Welcome to advice.
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>


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

Reply via email to