On 28/04/15 22:06, Tore Nilsen wrote:
I try to make a script in a field to allow only numbers or the decimal sign to
be entered into the field. To block any other key is easy, but I have run into
problems when I try to insert the decimal sign at the text insertion point in
the field.
This script only allows me to insert the decimal sign at the end of the string.
I seem to be unable to find any help in the lessons on the runner web site or
in the dictionary. Does anyone have a smart solution that I can use to impress
my students, and maybe help them in their preparations for their exam?
on keyDown theKey
if theKey is a number then
pass keyDown
end if
if theKey is "." or theKey is "," then
if the text of me is not empty and "." is not in me then
put "." after me
end if
end if
end keyDown
—
Tore Nilsen
_______________________________________________
set the text of the selectedText to "3"
Richmond.
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode