I have seen the Metrowerks tutorial and other sample codes which have the EventLoop code in this way..
static void AppEventLoop( void )
{
UInt16 error;
EventType event; do
{
EvtGetEvent( &event, evtWaitForever ); if ( ! SysHandleEvent( &event ) )
if ( ! MenuHandleEvent( 0, &event, &error ) )
if ( ! AppHandleEvent( &event ) )
FrmDispatchEvent( &event );} while ( event.eType != appStopEvent ); }
In our application we are setting using it like this
void EventLoop()
{
EventType event;
do
{
// 2000 -> Every 15 seconds there is a event, using for Analog clock
EvtGetEvent( &event, 2000 );
if ( not SysHandleEvent( &event ))
{
Word ignore;
if( not MenuHandleEvent( 0, &event, &ignore ))
{ if( FrmDispatchEvent( &event ))
{
event.eType = nilEvent; // kill appStopEvent }
else if( event.eType == frmLoadEvent )
{
const Word formID = event.data.frmLoad.formID;
FormPtr form = FrmInitForm( formID );
FrmSetActiveForm( form );
//GetEventHandler returns ptr to FormEventHandlerType
FrmSetEventHandler( form, GetEventHandler( formID )); } }
}
}
while( event.eType != appStopEvent );
}
What is the difference between the two and which one should I follow? What is the effect of FrmDispatchEvent being called before Application specific event handler. Thanking you before hand. Hope to hear from some of you.
regards jayan
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
