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: