How do I force a key to enter just one character when being pressed?

William de Smet williamdesmet at
Wed Jan 19 06:02:07 EST 2011

Thanks John,

But with this script I limt the entry of the field to just one character.
My 'problem' is dat when you keep a key pressed down more characters
are entered.
When you hold down the 'A' key AAAAAAAAAAA is entered.
I wish to limit that. Just one entry of a key when being hold
down/pressed al the time.

Any thoughts on this?



2011/1/19 John Dixon <dixonja at>:
> In the script of fld "text"...
> on keyDown theKey
>   if the number of chars of fld "text" > 0 then
>      beep
>      exit keyDown
>   else
>      put theKey into fld "text"
>   end if
> end keyDown
>> Hi there,
>> I limit text entry of fld "text" with following code.
>> on keyDown pKey
>>    if (the formattedHeight of fld "text" < the height of fld "text")
>>   then
>>   pass keyDown
>>   end if
>> end keyDown
>> One thing that I want to change now is a way to force a key to enter
>> just one character after being pressed/hold down.
>> Any thoughts on that?
>> greetings,
>> William
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list