Access underlying value of TextField when deferUpdates is true

When deferUpdates is true, you only ‘see’ the text inserted into a field when it has been competed, that is the control loses focus or enter is pressed.
This is very useful because I only validate complete values; infact i bound the to the text property with a transformation that validates the input and returns green for correct and red for incorrect values:

if int(value)<100:
	return "#00FF00"
	return "#FF0000"

So far so good.

Now, when the user enters a value that proves to be wrong and makes the background turn red, she starts correcting it, changing the value.
During this editing the background stays red and this is suboptimal because it referes to the previous value. Instead, I would like that the background turned withe again like for not-yet-completed input.

The easiest way to do it is to compare the actual value (that is the not yet committed value) of the TextField with the committed one (that is the text property); if they differ, make the background white (in the background binding, of course; maybe an explicit refresh has to be called to make it work, but these are just details).
Is there a way to access this information?
If not, is there any alternative?

I tried to revert the background color to white on the KeyPress event of the TextField: = "#FFFFFF"

Something works:

  • Reverting to white works
  • Validating (on enter or loosing focus) still works

Unfortunately this introduces another unwanted behavior.
Pressing an additional enter causes a validated (red or green) control to turn white again.
That is because pressing enter triggers the KeyPress event that turns the background white.
Since the binding is intelligent and sees no change in the content, it doesn’t trigger the backgroundColor update anymore because it get refreshed only when there is an actual change in the text property.
This way a validated (red or green) TextField turns white if a second enter is pressed.
If only I could access the actual text property I would have enough infromation to get it right.
Any idea?

On KeyPress event could you verify the current value of the text… if it is green keep it green and only turn it white if it was red?