How can I restrict a users input to be only numeric (allowing decimals) when typing into certain fields in a desktop application?
~Roger
Note that Ben's answer doesn't cover every case
You can do all those with
local sExisting
on openfield
put the text of me into sExisting
end openfield
on textChanged
put the selectedText && sExisting && the text of me into msg
if the text of me is a number or me is empty then
put the text of me into sExisting
else
put sExisting into me
end if
end textChanged
NB - if you type an invalid character, the input cursor is moved to the start of the line; if you want to do anything different then you can lockscreen (as the first action in 'textChanged') and unlock when you are done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With