> I want to catch the hardware button events and read that I 
> just have to look
> for the keyDownEvent. There I have to look for the 
> event.data.keyDown.chr
> value and look for hard1Chr ... hard4Chr.
> 
> I tried to get the scroll buttons with pageUpChr and 
> pageDownChr which works
> fine ... but I don't receive a keyDownEvent at all when I 
> click on memo pad
> or the others ... so I can't say whether there is a 
> "hard1Chr" or not ...
> 
> Can anybody help me please ?
> 

I had the same problem a while back.  You need to put your handler in your
application event loop right after calling EvtGetEvent ().  Otherwise, the
OS will handle the event before your form's event handler gets a crack at
it.

Something like:

static void AppEventLoop (void)
{
    EventType   event;
        UInt16          err;

    do 
    {
        EvtGetEvent (&event, evtWaitForever);

        // Check for disallowed keys
        if (TrapHardButtons (&event))
        {
                FrmAlert (HardKeyErrorAlert);
        }
        else
        if (! SysHandleEvent (&event))
                if (! MenuHandleEvent (NULL, &event, &err))
                    if (! AppHandleEvent (&event))
                            FrmDispatchEvent (&event);
    } while (event.eType != appStopEvent);
.......and so on.

TrapHardButtons would be a function that returns a boolean value based on
whether one of the app hard keys defined in chars.h was pressed.

Cheers,

-DGA

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

Reply via email to