I'm trying to make it so the user can only enter numbers and allow there to be only 2 decimal places entered. I have that part working. The problem is that after entering the 2 numbers after the decimal, I can't enter or edit any numbers in front of the decimal. Any help would be appreciated.
Code: Select all
on keyDown pKey
put the text of me into theValue
set the itemDel to "."
if theValue contains "." then
put the number of chars of item 2 of theValue into tCentsCount
if tCentsCount > 1 then
exit keyDown
else
pass keyDown
end if
else if pKey is a number then
pass keyDown
else
if pKey is "." and"." is not in the text of me then
pass keyDown
else
exit keyDown
else
if pKey is a number then
pass keyDown
end if
end if
end if
end keyDown