Ed Pugh wrote:

Thanks for your reply. Yes, I know I have to re-sync the two timers when the palm powers back up, but my main question is HOW do I do that? I.e. just what event can I use to trigger the fact that the palm has just been turned back on? (While the application is already running; i.e. it was running when the palm was turned off or "auto-offed".)

Being a pragmatic person, I just found a method that worked for me. In the form handler, process the nilEvents. Get the TimGetSeconds() value, and compare it to a stored value that you set the last time. If the stored value is farther in the past than 1 second or so (depending upon your EvtGetEvent setting to generate nil events) then you can ASSUME that the device needs to be re-synched. Now, if you open another dialogue on top of the form then you will stop writing that timing value. Upon closing the dialogue again the form it will mistakenly call for a resynch, even though the device has not been off. So, basically, you are resynching every time you open the form. This is not generally a problem, because it is done quite quickly. This method may not be elegant, but it is completely device and OS version independant.

Another way to do it without using notifications is to look at all the KeyDown events, and test them to see if they are causing the device to go to sleep. If so, set a flag that, upon wakeup, will prompt a resynch. This would only work in your own app, so you would also automatically resynch upon launching your app.

Many ways to skin a cat...

Bob.

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

Reply via email to