Hello all,
I have a text field that needs to have only real numbers as input. So I want to trap input that can’t be coerced to real, beep, erase the entered characters, and stay in that field, by saying
on end editing theObject
try
set theRealValue to content of theObject as real
on error
beep
set content of theObject to "" --does nothing
return
end try
end end editing
It traps just fine, and beeps, but never sets the text contents of the object (a simple text field) back to the empty string.
I’ve tried every variant of addressing the content of the object to no avail. I can read it but I can’t write it. Setting the “needs display” of it does nothing also.
Can you not alter text field contents in a Try block? Thanks for any advice.