Adjusting a field size based upon its contents

Martin Baxter mb.userev at harbourhosting.co.uk
Sat Nov 17 09:22:48 EST 2007


Francis Nugent Dixon wrote:
> Hi from Paris,
> 
> I have a hidden field that I want to display after I have put a specific
> text in it. The text is of variable size.
> 
> The size of field required is obviously based on the "textSize",
> "textFont" and "number of characters" values. I need to set the size of
> the field (rect) so that it is just big enough for the text to be
> displayed.
> 
> If I had a few days available, I could surely work out an algorithm to
> do this, but I need to get the new version of my application out of the
> door quickly.
> 
> Has anybody come across this problem (and solved it) ?
> 
> Many Thanks
> 
> -Francis

Hi Francis,
see the formattedheight and formattedwidth properties. These should give
you the information you need to resize the field before displaying it.

Martin Baxter



More information about the use-livecode mailing list