I think you might need a "break" before
case menuEvent:
Probably what is happening is that the event is falling through your
ctlSelectEvent case statement, and then continues on through the menuEvent
case, where MainFormDoCommand is called. I would guess that
MainFormDoCommand just pops up the about box . . . ?
Cheers,
-DGA
> Ok. I have two buttons on my form. One is the about
> button and the other on a clear button that I would
> like to make the palm light go on with. If I click on
> the about button the about form popups up. but if I
> click on the clear button (which should only turn the
> light on or off) the about form will popup after the
> light goes on??
>
> static Boolean MainFormHandleEvent(EventPtr eventP)
> {
> Boolean handled = false;
> FormPtr frmP;
>
> switch (eventP->eType)
> {
> case ctlSelectEvent:
> UInt16 ctrlID =
> eventP->data.ctlSelect.controlID;
> ControlPtr ctrlPtr=
> eventP->data.ctlSelect.pControl;
>
> if (ctrlID == MainAboutButton)
> {
> frmP = FrmInitForm (AboutForm);
> FrmDoDialog (frmP);
> FrmDeleteForm (frmP);
> handled = true;
> }
>
> if (ctrlID == MainClearButton)
> {
> EventType theEvent;
>
>
> theEvent.eType = keyDownEvent;
> theEvent.data.keyDown.chr =
> backlightChr ;
> theEvent.data.keyDown.keyCode = 0;
> theEvent.data.keyDown.modifiers
> = commandKeyMask;
>
> EvtAddEventToQueue(&theEvent);
> handled = true;
> }
>
>
> case menuEvent:
> return
> MainFormDoCommand(eventP->data.menu.itemID);
>
> case frmOpenEvent:
> frmP = FrmGetActiveForm();
> MainFormInit( frmP);
> FrmDrawForm ( frmP);
> handled = true;
> break;
>
> default:
> break;
>
> }
>
> return handled;
> }
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/