> 
> The (common) suggestion to trap the key in your main event loop
> has been identified as bogus because certain OS functions, such as
> the alert windows, have their own event loops.
>
> Is there a rock solid way of trapping these button presses?
>
> Because to trap something some of the time is worse than not
> trapping it at all!

There are two choices:

1) Look for button presses in your main event loop. If you've got a hard
key, don't call SysHandleEvent.  Alerts and dialogs, which have their own
event loops, *will* stil call SysHandleEvent.  Thus, when you return from a
dialog or alert, it may be because the user has pressed a hard button.
However, at that point, you can look in the event queue for an appStopEvent,
and ignore it.

2) Do as the Hardball sample does:
     Use KeySetMask to specify that the hard buttons shouldn't generate
keyDownEvents:
    Then, poll the hard key states with KeyCurrentState when you're
interested whether they are down or up.

Neil
>
> Roger Stringer
> Marietta Systems, Inc.
>
> -------------------------------------------------------------
>
>>Subject: Hard button events
>>From: "Anson, Gary" <[EMAIL PROTECTED]>
>>Date: Wed, 23 Feb 2000 09:09:52 -0800
>
>>I was also wondering how to determine if one of the hard buttons is pressed
>>and then released to be able to recognise the release?
>


--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA  92374
(909) 793-5995     [EMAIL PROTECTED]      fax: (909) 793-2545

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to