Text length

Simon Lord slord at mac.com
Fri Aug 9 00:06:01 EDT 2002


Here is a small problem I'm having with text *collisions*.  I 
have a field who's contents are the names, dates and sizes of 
all the files in a directory.  The items are separated by a set 
of tabs, which can me adjusted left or right via a widget at the 
top of the field. So imagine sliding this widget and seeing the 
filenames stationary on the left but the filesize and date are 
in motion on the right.  The are moving because the distance 
(via tab length) is being adjusted to increase the space between 
these items.

My problem is that if I adjust the tabs too  far to the left the 
size column collides into the names and the formating goes 
completely out the window (ie the fake columns I created by 
setting tab widths is completely disregarded and stuff just 
formats willy nilly)

My question is, is there a way to return the length of text in 
pixels?  My column data is still separated by comma's so I'd 
love to see a solution that would allow me to get "item 1" and 
return that length in pixels.  There is a backwards solutions 
that allows me to get the length in characters, ad if I wrote a 
function I could sort of assume 5 pixels per character and 
multiply that by the length but this starts to slow things 
down.   Is there a faster method?

Sincerely,
Simon




More information about the metacard mailing list