I react to both keyDownEvent and fldChangedEvent. There is one
slightly tricky thing you need to do to get this working smoothly
though (ie. updating as the user inputs the text). When you receive
these events, the new data in the field isn't available to you just
yet. If you recalculate your forms based on this data, you will in
essence be one character behind. To get around this, instead of
recalculating when receiving these events, you send a custom event.
Then, it is within the custom event handler that you recalculate the
form.

So, try something like this:

Boolean EventHandler(EventPtr eventP)
{
  Boolean handled = false;

  switch(eventP->eType)
  {
    ...
    case fldChangedEvent:
      FireCustomEvent(appDataChangedEvent);
      handled = true;
      break;
    case keyDownEvent:
      FireCustomEvent(appDataChangedEvent);
      break;
    case appDataChangedEvent:
      ReCalculateForm();
      handled = true;
      break;
    ...
  }

  return(handled);
}

You will of course need to define your own custom event, in this
example it's appDataChangedEvent. Start by looking for the definition
of firstUserEvent within the Event.h Palm standard header.

Hope that helps,
Adrien.

Wednesday, October 13, 2004, 3:13:19 AM, you wrote:

A> I want to call a function whenever the user writes something
A> into a field. Which event do I have to react to for it? The only
A> thing I found so far is he keyDownEvent, but that occurs when the
A> user STARTS writing, however I need an event whoch occurs when the
A> user has FINISHED writing, as I need to obtain the new value in the
A> field to do some calculations with it.
A> Any ideas, anyone?

A> Thnx for your help and rgds,

A> Andy




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

Reply via email to