Hi all,

I'm handling the 5-way key events but I want to deal with them differently in different forms. I've been doing this by intercepting the events early and generating my own, custom events:

do {
EvtGetEvent(&event, evtWaitForever);
if (!appHandleKeyEvent (&event)) // <--- CAPTURE EVENTS EARLY
if (!SysHandleEvent (&event)) // ...
FrmDispatchEvent (&event);
} while (event.eType != appStopEvent);


and then...

   static Boolean appHandleKeyEvent (EventPtr pInEvent)
   {   EventType outEvent;
       if ((pInEvent->eType==keyDownEvent)
           && (pInEvent->data.keyDown.modifiers==commandKeyMask)) {

           switch(pInEvent->data.keyDown.chr) {
           case btnHardUp:
               outEvent.eType        =  myUpButtonEvent;
               EvtAddEventToQueue (&outEvent);
               break;
         // ...
   }

But this is slow. I was wondering whether it was okay if, instead, I could have appHandleKeyEvent overwrite the info in the event:

   static Boolean appHandleKeyEvent (EventPtr pInEvent)
   {   EventType outEvent;
       if ((pInEvent->eType==keyDownEvent)
           && (pInEvent->data.keyDown.modifiers==commandKeyMask)) {

switch(pInEvent->data.keyDown.chr) {
case btnHardUp:
pInEvent->eType = myUpButtonEvent; // <--- HERE is the change
break;
// ...
}


Is it acceptable to replace the event in mid-stream or do I still have to create a new event? Is there a faster way to do this?

Thanks!

--
Wade
[EMAIL PROTECTED]



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

Reply via email to