Limiting the number of characters per line in a scrolling field?

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Apr 23 16:09:34 EDT 2005


Hi Glen,

One liner handler in the script of your field (if you please) :

on keyDown pKey
   if (pKey is an integer) and (the number of chars of the selectedLine 
< 5) then pass keyDown
end keyDown

Best regards from Paris,

PS. My ears don't like beep ;-)

Le 23 avr. 05, à 12:50, Glen Bojsza a écrit :

> I would like to limit the number of characters a user can input on any
> line in a scrolling field.
>
> In the field script
>
> on keydown theKey
>   if theKey is not in " 0 1 2 3 4 5 6 7 8 9 - . " then
>     beep
>     exit keydown

No need exiting: nothing else can happen!

>   else
>     if (the length of me) > 4 then
>       beep
>       exit keydown

Same comment :-)

>     end if
>     pass keydown
>   end if
> end keydown
>
>   "if the length of me is > 4 then..."  this works but limits the
> TOTAL field to 4 characters.


Amicalement,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
----------------------------------------------------------------
Web site		http://www.sosmartsoftware.com/
Email		eric.chatonet at sosmartsoftware.com/
Phone		33 (0)1 43 31 77 62
Mobile		33 (0)6 20 74 50 86
----------------------------------------------------------------



More information about the use-livecode mailing list