Trouble with formattedWidth

Graham Samuel livfoss at mac.com
Tue Apr 4 17:38:26 EDT 2006


I'm interested in truncating a character string to a certain number  
of pixels. As part of this process, I put the string into field and  
check the field's formattedWidth.  My script says

   put the formattedWidth of field "myField" into myTemp

I can verify that the string is really there and is not null.

The RR docs says:

> If you specify a field, the formattedWidth reports the width  
> required by the field's text.

Well, for me sometimes it does, and sometimes it doesn't. When it  
doesn't, the formattedWidth reports zero. I guess this is something  
to do with me forgetting to give any specific attributes of font or  
type size to the field (or the string), but what rules then apply? I  
am finding this very mysterious. I am pretty sure I can cook up a  
foolproof recipe for getting the zero, but before I do maybe someone  
could explain what is likely to be happening here.

TIA

Graham


----------------------------------------
Graham Samuel / The Living Fossil Co. / UK and France




More information about the use-livecode mailing list