restrict number of characters in a field?

Kay C Lan lan.kc.macmail at gmail.com
Wed Jul 26 00:14:04 EDT 2006


On 7/26/06, Peter T. Evensen <pevensen at siboneylg.com> wrote:
>
>
> on keyDown pKey
>     if the length of the text of me < 5 then
>          pass keyDown
>     end if
> end keyDown

(note, this hasn't been tested, but just written off the top of my head)


Tested and it works fine.

Here is a slight amendment to cater for large doses of text and touch
typists who don't usually look at the screen and may wonder where the last
dozen characters went.

on keyDown pKey
  if (the length of the text of me > 254) then
   beep
 else
   pass keyDown
 end if
end keyDown

This allows 255 (yes that is correct) characters in a field before it will
start beeping at you. This has been tested and comes with a 12" or 12sec
guarantee, which ever comes first:-)

HTH



More information about the use-livecode mailing list