I'm writing some code to handle the 5-way navigator supporting both the 
Tungsten C and the T5.  Using code taken from the sample app FiveWayV2 I've 
come up with this:

 m_oldNavLibrary = false;
 UInt16 gLibRefNum;
 Err error = SysLibFind( kPmKeyLibName, &gLibRefNum );
 if( error )
 {
  error = SysLibLoad( sysFileTLibrary, kPmKeyLibCreator, &gLibRefNum );
  if( error )
  {
   gLibRefNum = sysInvalidRefNum;
   m_oldNavLibrary = true;
   error = errNone;
  }
 }

 if( m_oldNavLibrary )
 {
  if( IsFiveWayNavEvent( event ) )
  {
   if( NavKeyPressed( event, Up ) )
    ScrollList( SCROLL_UP_SINGLE, true );
   else if( NavKeyPressed( event, Down ) )
    ScrollList( SCROLL_DOWN_SINGLE, true );
   else if( NavKeyPressed( event, Right ) )
    ScrollList( SCROLL_DOWN_PAGE, true );
   else if( NavKeyPressed( event, Left ) )
    ScrollList( SCROLL_UP_PAGE, true );
  }
 }
 else
 {
  if( event->data.keyUp.chr == vchrPageUp )
   ScrollList( SCROLL_UP_SINGLE, true );
  else if( event->data.keyUp.chr == vchrPageDown )
   ScrollList( SCROLL_DOWN_SINGLE, true );
  else if( event->data.keyUp.chr == vchrRockerRight ||
     ( event->data.keyDown.keyCode & ( navBitsAll | navChangeBitsAll ) ) == 
( navBitRight | navChangeRight ) )
   ScrollList( SCROLL_DOWN_PAGE, true );
  else if( event->data.keyUp.chr == vchrRockerLeft ||
     ( event->data.keyDown.keyCode & ( navBitsAll | navChangeBitsAll ) ) == 
( navBitLeft | navChangeLeft ) )
   ScrollList( SCROLL_UP_PAGE, true );
 }


My questions are:  Is this correct?  Are there any gottchas doing it this 
way?  And most of all, is there an easier way to do this and still support 
both devices (perhaps others as well)?

Used to be I could just use the macros defined in PalmNavigator.h(now 
PalmOneNavigator.h), simple as pie, but eveidently they don't work for newer 
devices like the T5 (by the way this is not decumented anyplace I could 
find).

 - Jim 



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

Reply via email to