1) Even though you are only interested in the ESC key, you still
are not checking for it properly. You might get a random event
that just happens to look like the ESC key. You really, really
should check it like so:
if ((event.eType == ctlEnterEvent) and (event.data.ctlEnter.controlID ==
btnESC))
2) If your call to FrmSetEventHandler() is in the normal place (i.e.,
AppHandleEvent()), then
you should be calling AppHandleEvent() after you call MenuHandleEvent()
and before you call FrmDispatchEvent(). Since you are not, that might be
preventing
your event handler from being installed.
3) If you cannot discover the problem, you can always manually popup the
form
like so:
FrmInitForm() // to create form
FrmSetActiveForm() // to make it active
FrmSetEventHandler() // to install the handler
Initialize the form data...
FrmDrawForm() // draw the form
----- Original Message -----
From: Mike Davis <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Friday, April 21, 2000 10:27 PM
Subject: Re: Why Event Not Processed
> > In reply to a message from "Mike Davis" <[EMAIL PROTECTED]>:
> >
> > Mike, I see a couple of things that look suspicious in your
> > CheckEscape() routine:
> >
> > 1. You don't check the event.type, you just access the event data
> > *assuming* that it's ctlEnterEvent.
>
> There are only two events that are of interest in this loop. The
> pressing of the ESC key, which is checked and the open form event
> which I am trying to pass on to the form handler.
>
> > 2. If you look at nearly all the example source code out there, they
> > call two other OS routines in the event loop besides
> > FrmDispatchEvent(): SysHandleEvent() and MenuHandleEvent(). My hunch
> > is SysHandleEvent() provides magic that is needed for event processing
> > to run as intended, and CheckEscape() is not allowing that magic to
> > happen.
>
> That is not the problem. I was trying to simplify this to the least
> amount of code, to keep it simple. This is the actual routine and it
> does have SysHandleEvent and MenuHandleEvent. I have tried it both
> ways without success.
>
> void CheckUserPaused(void) {
> EventType event;
> UInt16 err;
>
> EvtGetEvent(&event, 0);
> if(event.data.ctlEnter.controlID == btnESC) {
> progPaused = TRUE;
> }
> else {
> if (!SysHandleEvent(&event) && !MenuHandleEvent(0, &event,
> &err))
> FrmDispatchEvent(&event);
> }
> }
> }
>
> > > Here is the loop logic. One of the things that can be done in the
> > > do something section, is a FrmPopupForm(frmMyForm) but frmMyForm is
> > > never opened. I'm sure the problem lies with this Escape Function
> > > that is somehow not allowing events to reach my handler. Can anyone
> > > tell why this should not work? I do have event handlers for the
> > > form and I can open the form with FrmPopupForm(frmMyForm) from
> > > outside of the loop but not if FrmPopupForm is called while in this
> > > loop.
> > >
> > > file://Begin Loop
> > >
> > > CheckEscape()
> > > // do something
> > >
> > > file://Repeat Loop
> > >
> > >
> > > void CheckEscape(void) {
> > > EventType event;
> > > UInt16 err;
> > >
> > > EvtGetEvent(&event, 0);
> > > if(event.data.ctlEnter.controlID == btnESC) {
> > > progPaused = TRUE;
> > > }
> > > else {
> > > FrmDispatchEvent(&event);
> > > }
> > > }
> >
> >
> > --
> > Roger Chaplin
> > <[EMAIL PROTECTED]>
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> > please see http://www.palm.com/devzone/mailinglists.html
> >
>
>
> --
> -----------------------------------------------------------------
> Discussion Group: http://www.halcyon.com/ipscone/wwwboard/
>
> Protect your constitutional rights. Your favorite one may be next!
> -----------------------------------------------------------------
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html