--- [EMAIL PROTECTED] wrote:
>
> has anybody add a new event to the event queue using the
> following methods ?
>
> MemSet (&newEvent, sizeof(EventType), 0);
> newEvent.eType = firstUserEvent;
> ...
> EvtAddEventToQueue (&newEvent);
Yes.
>
> how do u catch this in Palm Os ver 4 ?
> although the event is added to the queue, it is not poped
> up unless I change timeout of EvtGetEvent to some value
> other than evtWaitForever or unless another system event
> (such as pendown) is generated.
> this happens only in version 4 for me.
> can anybody explain this to me.
What do you mean by "it is not poped up ..."?
Here is a sample you can try. To use it, first create a button with ID
= MainSetItButton on your MainForm.
In your MainFormHandleEvent:
case ctlSelectEvent:
if ( eventP->data.ctlEnter.controlID == MainSetItButton )
{
MemSet (&newEvent, sizeof(EventType), 0);
newEvent.eType = firstUserEvent;
EvtAddEventToQueue (&newEvent);
handled = true;
}
break;
Change your event loop like so:
do {
EvtGetEvent(&event, evtWaitForever);
if (event.eType == firstUserEvent)
WinDrawChars("caught the event!", 17, 10, 20);
if (! SysHandleEvent(&event))
if (! MenuHandleEvent(0, &event, &error))
if (! AppHandleEvent(&event))
FrmDispatchEvent(&event);
} while (event.eType != appStopEvent);
When you tap the button, you will see "caught the event!" on your
screen, thus verifying that the event can be caught, even on OS 4.x
>
> is it ok to change the timeout to evtNoWait in EvtGetEvent to
> slove this problem.
Don't set the timeout unless you want to look at events more often than
they naturally happen. When you set the timeout to anything other than
evtWaitForever, the system generates a nilEvent if it doesn't get
another event in the specified time. Note that you might receive a
nilEvent before the time is up. How many and when nilEvents are sent
varies with different versions of the OS. Therefore, if you are using
nilEvents for timing (e.g., for animation), check that enough time has
actually elapsed before doing something in response to the nilEvent.
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/