I too am also having a similar problem. I have it setup so that when a user
presses a certain button (usually 1st hard key) a custom menu pops up. It is
basically a list with a bitmap drawn over the border. I give the user the
option to scroll the list with the 5-way up or down (or in the case of a
device with no 5-way, pageUp or pageDown. If the user wants to select
something, he/she presses the 5-way select button. The problem is, some
options in the list pop-up a form. If you select an object that pops-up a
form, the form is immediatly drawn, then is closed because a 5-way select
was passed to it (or the system). I have tried passing handled = true after
doing what I need to, but that does not work.

Here is my code:

    case keyDownEvent:
        if (event->data.keyDown.chr == pageUpChr
#ifdef HAVE_PALMONE_SDK
     || event->data.keyDown.chr == keyRockerUp
#endif
    ) {
             if (StrNCaselessCompare(g->Url,"internal:open",13)!=0){
   if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {
    frm = FrmGetActiveForm();
               lst = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,
listOptions));
               lstItem = LstGetSelection (lst);
    lstTotal = LstGetNumberOfItems (lst);
    if (lstItem == 0){
     LstSetSelection (lst, lstTotal-1);
    }
    else {
     LstSetSelection (lst, lstItem-1);
    }
   } else {
    deactivateInputFld(g);
    fiveWayUp(g);
   }
              //scrollUp(g);
  }
        } else if (event->data.keyDown.chr == pageDownChr
#ifdef HAVE_PALMONE_SDK
     || event->data.keyDown.chr == keyRockerDown
#endif
        ) {
             if (StrNCaselessCompare(g->Url,"internal:open",13)!=0){
   if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {
               frm = FrmGetActiveForm();
               lst = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,
listOptions));
               lstItem = LstGetSelection (lst);
    lstTotal = LstGetNumberOfItems (lst);
    if (lstItem == lstTotal-1){
     LstSetSelection (lst, 0);
    }
    else {
     LstSetSelection (lst, lstItem+1);
    }
   } else {
    deactivateInputFld(g);
    fiveWayDown(g);
   }
   //scrollDown (g);
  }
        }
#ifdef HAVE_PALMONE_SDK
        else if(event->data.keyDown.chr == vchrNavChange) {
  if(keyCode & navBitRight){
   if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {

CtlHitControl((ControlPtr)FrmGetObjectPtr(FrmGetActiveForm(),FrmGetObjectInd
ex(FrmGetActiveForm(),buttonSoftOneb)));
   } else {
    deactivateInputFld(g);
    scrollDown(g);
   }
  }

  if(keyCode & navBitLeft){
   if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {

CtlHitControl((ControlPtr)FrmGetObjectPtr(FrmGetActiveForm(),FrmGetObjectInd
ex(FrmGetActiveForm(),buttonSoftOneb)));
   } else {
    deactivateInputFld(g);
               scrollUp(g);
   }
  }

  if(keyCode & navBitSelect){
   if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {
    handled = browserHandleOptionsList(LstGetSelection(FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm, listOptions))),g);
   } else {
    fiveWaySelect(g);
   }
  }
 } else if(event->data.keyDown.chr == keyRockerRight) {
  if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {

CtlHitControl((ControlPtr)FrmGetObjectPtr(FrmGetActiveForm(),FrmGetObjectInd
ex(FrmGetActiveForm(),buttonSoftOneb)));
  } else {
   deactivateInputFld(g);
   scrollDown(g);
  }
 } else if(event->data.keyDown.chr == keyRockerLeft) {
  if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {

CtlHitControl((ControlPtr)FrmGetObjectPtr(FrmGetActiveForm(),FrmGetObjectInd
ex(FrmGetActiveForm(),buttonSoftOneb)));
  } else {
   deactivateInputFld(g);
              scrollUp(g);
  }
 } else if(event->data.keyDown.chr == keyRockerCenter) {
  if (optMenuOpen == true && g_prefs.mode == MODE_ONEHAND) {
   handled = browserHandleOptionsList(LstGetSelection(FrmGetObjectPtr(frm,
FrmGetObjectIndex(frm, listOptions))),g);
  } else {
   fiveWaySelect(g);
  }
 }
#endif

        break;

There is some messy stuff in there, but I decided to leave it so that you
could see what I was doing. The code for some reason does not work on a
LifeDrive or T5.

Thanks,
Donald

"Jim McGowen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Glad to hear it's not just me :)
>
> "Robert Moynihan" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Jim McGowen wrote:
> >
> >>Just tried it again and it DOES work... must have copied something wrong
> >>the first time, sorry bout that!
> >>
> > Yeah, I thought that it had to work.
> >
> >>Still seeing multiple key down events though.  On that note, the
Tungsten
> >>C always uses the first half of your if statement, the T5 always uses
the
> >>else half.  If there are 2 events, the first one isn't handled by your
> >>code, but the second one is, except on the Tungsten C the select key is
> >>processed twice for a single press.  (that's debugging on the devices,
not
> >>sims)
> >>
> > This IS a hassle.  I don't remember the particulars right now, but I
know
> > for sure that I have some ugly, special-case code in there so that it
> > doesn't respond to the -- inevitable as far as I can tell -- double
> > presses on some devices.  I do return "true" after handling the keyDown
> > events but the repeats don't seem to stop.  I see this on my T3, but my
> > T600 doesn't send those keys, IIRC.
> >
> > Bob
> >
>
>
>



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

Reply via email to