How to test for a number

Cubist at aol.com Cubist at aol.com
Wed Mar 16 16:44:18 EST 2005


sez kj2005.28 at gmail.com:
>I like that idea of:
>
>on keydown tKey
>  if tKey is a number then
>     pass keydown
>  else
>    beep
>  end if
>end keydown
>
>Is it ok to put it in the main stack rather then puting it just for
>the fields.
   That depends on what you want the user to be able to do with the stack. 
Put that handler in the main stack script, and the user can NEVER type a 
non-numeral character into ANY field in that stack. Is that what you want? If you 
want *some* fields to be number-restricted, while others are normal, you could 
put that handler into the script of the appropriate card(s). If the 
number-restricted fields are all part of the same group, you can put that handler into the 
script of that group, and it will affect only the fields you want, while 
leaving everything else alone.
   Hope this helps...


More information about the use-livecode mailing list