on Fri, 9 Aug 2002 00:03:33, Simon Lord <[EMAIL PROTECTED]> explained
> 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? > Try something like this: function getwidth thecolumn,thefield set itemdelimiter to tab put 0 into x repeat for each line i in fld thefield get the formattedwidth of item thecolumn of i if it > x then put it into x end repeat return x end getwidth Using the formattedwidth this way works for *any* font size or type. Hope this helps. Let me know. Raymond > Sincerely, > Simon > _______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
