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

William de Smet wdesmet at wanadoo.nl
Thu Sep 21 14:47:33 EDT 2006


Hi there,

I just tested the suggested code and it works.
What if I want to limit text input based upon its height and width?

I just thought to replace the word 'height' with 'width' and put in
extra code but that doesn't work:
  if (the formattedHeight of field "tekst" < the height of field "tekst")
  then pass keyDown
  if (the formattedWidth of field "tekst" < the width of field "tekst")
  then pass keyDown

Any suggestions?

William



2006/9/18, William de Smet <wdesmet at wanadoo.nl>:
> 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 gmail.com>:
> > 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.
> >
> > HTH
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> >
>
>
> --
> ICT-coördinator
> Herman Broerenschool
> 2612 SP Delft
> 015-2141066
> http://www.hermanbroerenschool-delft.nl
>



More information about the use-livecode mailing list