Not passing a return key or enter key.

Dave Cragg dcragg at lacscentre.co.uk
Fri Aug 12 18:48:36 EDT 2005


On 12 Aug 2005, at 22:02, Glen Bojsza wrote:

> Hi All,
>
> I wish to limit the number of lines (no more than 3) in a field that a
> user add input.
>
> I have tried the following in the field's script
>
> on returnKey
>   if word 2 of the selectedline > 3 then exit returnKey
> end returnKey
>
> on enterKey
>   if word 2 of the selectedline > 3 then exit enterKey
> end enterKey
>
>
> But when I hit the enter key after 3 lines it still keeps going to the
> next line?


The messages you need to trap are returnInField and enterInField.  
returnKey and enterkey are not sent to fields that are being edited.  
I'm not sure why. It's caught me out a few times.

Also, you may need to prevent users from pasting more than three  
lines into the field. For that, you could use the pasteKey message.

Cheers
Dave



More information about the use-livecode mailing list