I am trying to implement a timer but have a few questions. Let me
explain my application a little more, maybe there's a different (easier)
way to do this...
A user is able to write a number into a field. Not all numbers are
allowed, say the number has to be a multiple of 5. If they write 7, my
function UpdateField() will update the said filed with the value 5.
This 5 needs to be written in the same text field that the user wrote
the 7 in. The number can be up to 1 to 5 digits so I don't know when
the user is done writing. I would like to use a timer and say that
following 'X' seconds of inactivity (AFTER writing in the field), to
read the number, send it to my correction function and write the new
number in the same field. If I implement a timer like shown below, the
MainFormHandle function isn't always a gate for the PC counter, thus the
counter cannot be located there, it needs to be somewhere else.
//Global
static UInt32 tStart=0, tStop=0, timCurrent=0;
static Boolean MainFormHandleEvent(EventType* pEvent)
{
switch (pEvent->eType) {
case frmOpenEvent:
pForm = FrmGetActiveForm();
FrmDrawForm(pForm);
tStart = TimGetSeconds();
tStop = tStart + delayTime;
handled = true;
break;
default:
break;
}
timCurrent = TimGetTicks();
if(timCurrent >= tStop)
UpdateField(newNum, fieldID); // update the text
field with the new number here
return handled;
}
any ideas?
thanks,
~Tony
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/