Updated to work around WristPDA API bug
Palm handhelds like the Tungsten T3(before the PalmOne 5way one-handed nav stuff I never quite liked) had a nifty feature – you pressed the center button of the 5way nav, and if the form contained a buton called OK, it was tapped automatically. Since Tam Hanna is a creature of habit, I wanted the enter button of the rocker of my WristPDA to do the same thing to open forms in Binary Clock for Palm OS.

After a quick check into the SDK I found out that Fossil has designated the back button for this task – no problem, lets handle both. Here is a bit of code that you can more-less cut and paste into the form handler of all forms where you want this behaviour(attention – you need the WristPDA SDK included and the user cant exit to the launcher from this form):


//This goes somewhere global
Boolean isWpda()
{
UInt32 foo;
if(WPdaGetVersion(&foo)==errNone)
{
return true;
}
return false;
}

//This goes into frmOpenEvent
if(isWpda())
{
FossilBackKeyModeSet(kFossilBackKeyLauncher);
}

//And this goes into the event loop of the form handler
case keyDownEvent:
//For WristPDA
if(pEvent->data.keyDown.chr==vchrHardRockerEnter || pEvent->data.keyDown.chr==vchrHardBack)
{
EventType event;
event.eType=ctlSelectEvent;
event.data.ctlSelect.controlID=OK;
EvtAddEventToQueue(&event);
FossilBackKeyModeSet(kFossilBackKeyStopEvent);
handled=true;
}
break;

There is little to be explained here – enjoy!

Related posts:

  1. FossilIsWristPDADevice causes (Sys 0505) (0,1092) error on non-WristPDA devices
  2. Soft and hardresetting a WristPDA
  3. popSelectEvent and the handled flag
  4. The WristPDA SDK – download it here
  5. Fossil Abacus WristPDA Review part 2 – WristPDA benchmarks

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

© 2013 TamsPalm - the Palm OS / web OS Blog Suffusion theme by Sayontan Sinha