Finding out that a field has changed is not easy on the Palm OS, as it doesnt have a “Field Changed” event like Visual Basic et al have. Since I needed such a snippet in the new AutoSync version, I decided to share it right here:

case keyDownEvent:
//send NilEvent
EvtSetNullEventTick(TimGetTicks()+ 2);
break;
case nilEvent:
//Field MAY have changed
foo();
break;

Basically, this code is straightforward. Whenever an user enters a character, a null event gets added to the queue. Whenever you get a null event, there is a possibility that the field has changed!

Related posts:

  1. FldFreeMemory – the field handle “cleanup service”
  2. Invalid Insertion Point Position via FldSetFocus – what to do
  3. Creating Palm OS events
  4. How to print integers, etc into a field
  5. popSelectEvent and the handled flag

One Response to “Finding out when a field changes”

  1. Ok, your code works, but is a bit stupid… What about this:

    case keyDownEvent:
    if (FldHandleEvent(GetObjectPtr(form, fieldID_input), event))
    {
    // the edit field did something with the key – it’s changed
    }

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

© 2012 TamsPalm - the Palm OS / web OS Blog Suffusion theme by Sayontan Sinha