numeric field

mark mitchell cowhead at mac.com
Thu Oct 10 09:27:01 EDT 2002


Jan wrote:

> Example: if you want a field that only accepts numeric
> input, here's what you would do:
>
> 1) Java: create a new subclass JNumericField of
> JTextField (i don't have my books at hand right now,
> so it could be a different class) and make it so that
> it only accepts numeric input. Then, whenever you need
> a numeric field, you make an instance of that class.
>
> 2) RunRev: look at the use-revolution archive and copy
> the script I posted a week or so ago ;-)
>

I was too busy when you posted that, but I didn't understand why a very 
simple script doesn't work for this.  I use this in a field script if I 
want to restrict it to numeric input:

on keydown whichKey
   if whichKey is a number then
     pass keyDown
   end if
end keydown

It works fine.  What was the point of that long winded thing?

mark mitchell
Japan




More information about the use-livecode mailing list