Constraining user input...

Ian Summerfield iansummerfield at
Thu Feb 28 15:57:01 EST 2002

Watch out for the power user who comes along and does a paste into your
field!  The paste won't trigger the keydown! You'll need a closefield
handler to compliment the keydown to get rid of the junk they paste:

On closefield
  put line 1 to 3 of me into me -- keep only the first 3 lines
  put char 1 to 30 of line 1 of me into line 1 of me -- 30 chars per line
  put char 1 to 30 of line 2 of me into line 2 of me -- 30 chars per line
  put char 1 to 30 of line 3 of me into line 3 of me -- 30 chars per line
End closefield

On 28/2/02 12:54 am, "Sarah Reichelt" <sarahr at> scribed:

> I don't know that this is a very elegant solution, but it works so it can
> get you started. Put this in the script of your text entry field.
> on keyDown theKey
> if the number of lines in me >= 3 and \
>     the number of chars in line 3 of me >= 30 then
>   beep
>   exit keyDown
> else
>   put word 2 of the selectedLine of me into theLine
>   if the number of chars in line theLine of me >= 30 then
>     beep
>     exit keyDown
>   end if
> else
>   pass keyDown
> end if
> end keyDown
> Cheers,
> Sarah
>> Hello, 
>> I am completely new to Revolution, but am very interested in using it for
>> on-going projects....  My single biggest need though is to be able to
>> constrain the user input to a set number of characters and lines... For
>> example, for a textbox entry they should only be able to enter 30 characters
>> of text per line and only 3 lines.....
>> Is this possible with Revolution?.. If you could provide an example I sure
>> would appreciate it.....
>> Thanks! 
>> Greg Saylor 
>> Senior Systems Integrator
> _______________________________________________
> use-revolution mailing list
> use-revolution at

Ian Summerfield
Macintosh Consultant - Hastings UK
ICQ: 4378866

     This E-mail is from Ian Summerfield's home system.
     The contents and any attachments to it include information that is
     private and confidential and should only be read by those persons to
     whom they are addressed. Ian accepts no liability for any loss
     or damage suffered by any person arising from the use of this e-mail.
     Ian does not accept any responsibility for viruses and it is your
     responsibility to check the email and attachments (if any).

     If you have received this e-mail in error, please destroy and delete
     the message from your computer.

More information about the Use-livecode mailing list