Is it possible to limit text input in a field based upon its height?

William de Smet wdesmet at
Mon Sep 18 15:04:50 EDT 2006

Hi there,

Thanks for your replies.
The suggestion Sarah gave works fine with text entries.
I also use pasted text and Kay C Lan's  code might work but I didn't
test it yet.

William de Smet

2006/9/18, Kay C Lan <lan.kc.macmail at>:
> Good responses for data as you type, but something else would be needed for
> pasted data.
> In such a case I generally force the use of monospace fonts, I can then
> quickly determine exactly how many characters can fit into the field:
> if (the number of chars of the clipboardData["Text"] > 543) then
>   put char 1 to 543 of the clipboard["Text"] into field "fixed size"
>   answer "Too much data"
> end if
> If monospace fonts are not your thing then
> repeat until the formattedHeight of field "fixed size" = the height of field
> "fixed size"
>   delete char -1 of field "fixed size"
> end repeat
> Obviously these scripts would need to be appropriately placed, either before
> or after the actual 'paste' command in the Edit button script of the Menubar
> group, along with a check that the 'focus' was on the appropriate field.
> Also, these may not work for keyboard shortcuts inside the IDE, but I'm led
> to believe that as a standalone they should.
> _______________________________________________
> use-revolution mailing list
> use-revolution at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

Herman Broerenschool
2612 SP Delft

More information about the Use-livecode mailing list