Limiting text input in a text entry field

Jinjenator jinjenator at googlemail.com
Sun Aug 17 07:46:52 EDT 2008


Sorry to waste time - figuredout a way....

on keyDown theKey
  if theKey is "." then pass KeyDown
  else if theKey is a number then pass KeyDown
  else beep
end keyDown


2008/8/17 Jinjenator <jinjenator at googlemail.com>:
> Doh! Obviously still half asleep!
>
> I meant accepting a decimal - it doesn't like the point - I tried
> specifying "." but didn't make a difference....
>
> 2008/8/17 Jinjenator <jinjenator at googlemail.com>:
>> Hi!
>>
>> This should be a straightforward thing but I can only partially get it working.
>> I'm trying to limit a text fields input to only numbers and integers -
>> I can get numbers only by using:
>>
>> on keyDown theKey
>>  if theKey is not a number then beep
>>  else pass keyDown
>> end keyDown
>>
>> but I can't get it to accept integers, even if I specify 'an integer' in above.
>>
>> I think I'm missing something simple!
>>
>> Cheers
>> Neil
>>
>



More information about the use-livecode mailing list