I'm checking the events for a keydown before anything else, as shown here:
void AppEventLoop(void)
{
Word error;
EventType event; do
{
EvtGetEvent(&event, 10);
// Intercept hardware application buttons.
if( SpecialKeyDown( &event ) )
continue;
if (! SysHandleEvent( &event ) )
if (! MenuHandleEvent( 0, &event, &error) )
if (! AppHandleEvent( &event ) )
FrmDispatchEvent( &event );} while( event.eType != appStopEvent ); }
Here I am checking to see if the event contains a keydown for any of the hardware keys that I am interested in. If it does, I pass the event to the appropriate form.
Boolean SpecialKeyDown( EventType *event )
{
Boolean handled = false;
CharPtr Temp = (CharPtr) MemPtrNew( 5 );
if( event->eType != keyDownEvent)
return handled;
if( event->data.keyDown.modifiers & poweredOnKeyMask )
return handled;
if( Temp )
{
Temp = StrIToH( Temp, event->data.keyDown.chr);
WinDrawChars( Temp, 80, 80, 4 );
MemPtrFree( Temp );
}
switch( event->data.keyDown.chr )
{
case vchrHard1: // Datebook button.
case vchrHard2: // Address button.
case vchrHard3: // To Do Button.
case vchrHard4: // Memo button
case vchrNextField: // handera support
case vchrPrevField: // handera support
case vchrPageUp:
case vchrPageDown:
case vchrRockerUp:
case vchrRockerDown:
case vchrRockerLeft:
case vchrRockerRight:
case vchrRockerCenter:
case vchrHardRockerCenter:
case vchrThumbWheelUp:
case vchrThumbWheelDown:
case vchrThumbWheelPush:
case vchrThumbWheelBack:
if( FrmGetActiveFormID() == MainForm ) handled = MainFormHandleKeyDownEvent( event );
else if( FrmGetActiveFormID() == MapForm ) handled = MapFormHandleKeyDownEvent( event );
else if( FrmGetActiveFormID() == WeaponForm ) handled = WeaponFormHandleKeyDownEvent( event );
// Don't ever let the system leave the game via the hard buttons.
handled = true;
break;
default:
break;
}
return handled;
}
Is it possible that the rocker left, right, and center buttons are only passed when there are controls on the form? If so, how do I get around that?
Any help is greatly appreciated.
Regards, David
-- Trinfinity Software http://www.TrinfinitySoftware.com [EMAIL PROTECTED]
============================================= Creators of these popular shareware products:
Seagull Video Player Make video playlists and play them full screen! http://www.trinfinitysoftware.com/seagull.shtml
Time Track Still keeping track of your time with a pencil and paper? Let Time Track do it for you! http://www.trinfinitysoftware.com/timetrack.shtml =============================================
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
