If you invoke modal UI objects, the event loop is out of your hands. Nasty part of doing business with events (especially custom events) or using an event loop.
There are several ways to prevent a device from going to sleep. I think all of them have already been mentioned. If EvtResetAutoOffTimer() in the event loop didn't work (modals?), try one of the others, eg EvtSetAutoOffTimer(). To recap: 1. EvtResetAutoOffTimer() simply resets the auto-off timer, but does not deactivate it. If the auto-off timer ever reaches the timeout value (see EvtSetAutoOffTimer()), the device will attempt to auto-off. You must call EvtResetAutoOffTimer() before the auto-off timer counts up to the timeout value. This is useful when you are certain you can keep up with the auto-off timer (beware of modals and long compute bound procedures). 2. Use EvtSetAutoOffTimer() to modify the auto-off timer. I believe setting the timeout value to zero disables auto-off. Be careful that you don't leave it disabled, so that it never goes to sleep, unless draining the battery is really what you want to do :) 3. Register for and intercept the sleep notifications. There's a white paper and a discussion under notifications in the companion. 4. If you are in charge of the event loop (beware of modals), you can waylay the power-off and auto-off keys. -------------------- Jeff Loucks Work 425-284-1128 [EMAIL PROTECTED] Home 253-851-8908 [EMAIL PROTECTED] Mobile 253-691-8812 -----Original Message----- From: Tony Janke [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 3:18 PM To: Palm Developer Forum Subject: Re: How to prevent the device from going to sleep? I tried sticking that command in my AppEventLoop function following the function EvtGetEvent and that didn't work for me, the device still went to sleep. Where else can you place it so it is constantly accessed while my app is running? ~Tony -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
