Your application will get a keydown event for the power button press when
the device comes back on as well as when it turns off. The key event you get
is hardPowerChr. If you get an auto-off, you will receive a autoOffChr. Here
is a code snippet that shows how I'm handling it in some cases:
if (event->eType == keyDownEvent)
{
if ((event->data.keyDown.chr >= hard1Chr &&
event->data.keyDown.chr <= hard4Chr &&
!(event->data.keyDown.modifiers & poweredOnKeyMask)))
{
if (HandleHardKey(event->data.keyDown.chr))
return CMD_DONTHANDLE;
}
if (event->data.keyDown.chr == hardPowerChr ||
event->data.keyDown.chr == autoOffChr)
return CMD_POWEROFF;
if (event->data.keyDown.chr == launchChr)
return CMD_LAUNCHER;
}
HandleHardKey, CMD_DONTHANDLE, CMD_POWEROFF, and CMD_LAUNCHER are all
application defined things in my code, don't look for them in the SDK :) ..
this is only intended to give you an idea of what you can trap for these
things. hard1Chr through hard4Chr are, as you may have guessed, the four
buttons along the bottom of the device.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/