Marvin Bellamy wrote:

> I'm trying to make dynamic changes within my application based on
> each character a user enters into a text field.  My application
> generates a keyDownEvent, but this event is created *before* the
> text field is actually modified.  So, my subsequent query on the
> text field for the current field value returns the *old* value,
> and not the new value including the last character entered.

I ran into this exact problem myself.  I solved it by creating my
own user event.  When I get a keyDownEvent, I check if the
character is virtual.  If it's not virtual, I enqueue my event
(let's call it myFieldModifiedEvent), but I do not mark the
keyDownEvent handled.  Thus, the system handles the keyDownEvent
and changes the field.  By the time the myFieldModifiedEvent comes
back around at the end of the queue, the OS has updated the field,
and everything is good.

Also, to err on the side of caution, I enqueue a
myFieldModifiedEvent whenever I receive a fldChangedEvent (which I
also do not mark as handled).  I don't know if this is really
necessary since fldChangedEvent seems to refer to the externals
of the field having been changed.  But it can't hurt.

I believe I also keep the previous contents of the field around
as a string and compare every time I get a myFieldModifiedEvent,
so that I can filter out spurious events that did not actually
change the field's contents.

  - Logan

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

Reply via email to