Dave,

Thanks for the info.  I used the polling method with the KeyCurrentState()
function to get it to work.

Regards,

Mike McCollister

--- Dave Lippincott <[EMAIL PROTECTED]> wrote:
> One method: You could use the keyDown event to get notified when a hard key
> is pressed.  I would then start polling the key to see when its released.
> Read about the Key Manager in the SDK docs for specific functions.  The
> Reptoids source included in the SDK may help.
> 
> ----- Original Message -----
> From: "Mike McCollister" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Monday, September 09, 2002 11:48 AM
> Subject: How to Detect if a hard key is pressed
> 
> 
> > Hi,
> >
> > I am working on an application that will use the hard keys as a means of
> input.
> >  In my test code, I want to be able to press a hard key and have the
> device
> > beep until I lift the hard key.  I can sense if a hard key is pressed by
> doing
> > this:
> >
> > // handle pressing of hard keys
> > if(event.eType == keyDownEvent) {
> >    if(TxtCharIsHardKey(event.data.keyDown.modifiers,
> >                        event.data.keyDown.chr)) {
> >       switch(event.data.keyDown.chr) {
> >          case vchrHard1:
> >          case vchrHard2:
> >          case vchrHard3:
> >          case vchrHard4:
> >             bGotHardKey = true;
> >             break;
> >
> >          default:
> >             break;
> >       }
> >    }
> > }
> >
> > // handle any system events
> > if(bGotHardKey == false)
> >    if(SysHandleEvent(&event))
> >       continue;
> >
> > in my event loop.  I can then handle what to do with the hard key in my
> > AppHandleEvent routine.  I can even detect if the key is pressed down for
> a
> > long time using the autoRepeatKeyMask.  However, I don't know how to
> detect
> > when the key is lifted (or unpressed).  There seems to be no event for
> when a
> > key is no longer pressed.  Any ideas on how to do that?
> >
> > Thanks,
> >
> > Mike McCollister
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Finance - Get real-time stock quotes
> > http://finance.yahoo.com
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
> >
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe, please
> see http://www.palmos.com/dev/support/forums/


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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

Reply via email to