The mentioned form is called by FrmInitForm and FrmDoDialog. Because
FrmInitForm is called before the EventHandle fucntion is assigned to it,
therefore  FrmSetFocus in frmOpenEvent is never executed. I put the
FrmSetFocus right before calling to FrmDoDialog and the problem is solved.

Does this mean that nilEvent is sent to the form that has the cursor focus
only ?

Vu


----- Original Message ----- 
From: "Vu Pham" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, December 09, 2003 8:44 PM
Subject: Re: nilEvent


> Thanks, John, for your reply.
>
> Yes, I have this line in frmOpenEvent
> FrmSetFocus( frmP, FrmGetObjectIndex(frmP,DataInputNameField ));
>
> I just added the following lines to the nilEvent case ( to see if nilEvent
> is really fired ) :
>
>     static int count = 1;
>     char message[16];
>     StrPrintF( message, "%ld, %ld", count++, TimGetSeconds() -
tarttime  );
>     SetFieldText( (FieldType*) FrmGetObjectPtr( FrmGetActiveForm(),
> FrmGetObjectIndex( FrmGetActiveForm(),DataInputNameField)), message,
true );
>
>
> If I don't click to the field, then it displays nothing there. But if I
> click, it displays {x,y} that I print for test.
>
> I can not figure out what is the relationship between the focus and
nilEvent
> here.
>
> Vu
>
> ----- Original Message ----- 
> From: "John Leung" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 09, 2003 8:33 PM
> Subject: Re: nilEvent
>
>
> > Have you tried using FrmSetFocus to initialize "the cursor" to one of
the
> > fields?
> >
> >
> > On 9 Dec 2003 at 20:10, Vu Pham wrote:
> >
> > > Hi all,
> > >
> > > I work on a form that waits for user input two data fields. If the
user
> does not
> > > input after a given interval, this form will close by itself and user
> defautl
> > > values for these fields. I use the nilEvent for checking the timeout (
> and I
> > > remember to set timeout value of EvtGetEvent to a positive value
> EvtGetEvent(
> > > &event, 5 ); ).
> > >
> > > The code is simple :
> > > static UInt32 starttime = 0;
> > > ....
> > >   case nilEvent:
> > >    if ( starttime == 0 ) starttime = TimGetSeconds();
> > >    else if ( TimGetSeconds() - starttime >= TIMEOUT_WAIT_FOR_INPUT )
> > >    {
> > >     StrCopy( gName, DEFAULT_NAME );
> > >     StrCopy( gNumber, DEFAULT_NUMBER );
> > >     FrmReturnToForm( MainForm );
> > >    }
> > >    return false;
> > >
> > > But the weird thing is this code
> > > 1. does not work on the normal PalmOS 5 simulator, but works on the
Treo
> > > simulator. This code, of course, has nothing to do with the Treo
> simulator.
> > > 2. On the normal PalmOS 5 simulator, if I click to any field so that
the
> > > field displays the cursir, then it works ( In practise, I can not ask
> the
> > > user to click otherwisr he can input data by himself ).
> > >
> > > I appreciate any of your advice,
> > >
> > > Thanks,
> > >
> > > Vu
> > >
> > >
> > > -- 
> > > For information on using the Palm Developer Forums, or to unsubscribe,
> please
> > > see http://www.palmos.com/dev/support/forums/
> > >
> > >
> >
> >
> >
> > -- 
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
> >
>
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>


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

Reply via email to