Hi all,
Some background first. I'm writing a little game, which uses the hardware
buttons for controls. For most of the buttons I'm interested in whether
the button is down or not. For those, just before the action starts, I
prevent them from generating events:
keymask = oldKeyMask;
keymask -= (keymask & keyBitPageUp);
keymask -= (keymask & keyBitPageDown);
keymask -= (keymask & keyBitHard1);
keymask -= (keymask & keyBitHard2);
keymask -= (keymask & keyBitHard4);
KeySetMask(keymask);
Those buttons are read with KeyCurrentState(), these work almost like I
expect. The checklist button is used for a toggle type of control, so I
steal the correct keyDown events before SysHandleEvent() gets its hands on
it:
// called before SysHandleEvent
static Boolean eventSnatcher(EventPtr event)
{
Boolean handled = false;
switch(event->eType)
{
case keyDownEvent:
if(event->data.keyDown.chr == vchrHard3)
{
landingGear = !landingGear;
handled = true;
}
break;
}
return handled;
}
Normally this works fine, too. Now the weird parts:
1) If I press both the up & down buttons down (pun not intended :-) and
then press the calendar button, KeyCurrentState() tells that the address
list button is also pressed. Is this the same effect that happens on some
regular keyboards, that when certain key combination is down, some other
keys can't be detected? Or should I just go debugging...
2) The eventSnatched checklist button works as expected when it's on its
own. When i keep the calendar button down and then press the checklist
button, I get thrown to the calendar application. Address list down +
checklist behaves similarly.
My palm is a IIIe with PalmOS 3.1.1, I think. I put the
(unfinished) program available at
http://www.cs.helsinki.fi/~attuomin/taxi.prc for anyone who wants to test
by themselves. OS >= 3.0 should be fine, I haven't bothered with much
error checking yet :-) Actually, I'd like to hear comments on how it runs
on other platforms. (A nice excuse for a break from serious
developing.) IIIe hasn't had trouble yet keeping up to speed with
my overkills (like 50fps animation :-).
The source is a bit ugly at this point, but those who are interested can
email me directly and ask for a copy.
regards,
Antti Tuominen
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/