function to calculate string length...
chipp at chipp.com
Sun Dec 26 07:21:54 EST 2004
Well, I cobbled this together from some of the archives...
Anyone see an obvious place to optimize?
on formatFld pFldName, pTxt
put the width of fld pFldName into tW
set the width of fld "formatCheck" to tW
repeat for each line L in pTxt
put L into fld "formatCheck"
put false into tIsTooLong
repeat while the formattedwidth of fld "formatCheck" > tW
delete last char of fld "formatCheck"
put true into tIsTooLong
if tIsTooLong is true then
put fld "formatCheck" after tList
delete char -5 to -1 of tList
put "..." & cr after tList
put L & cr after tList
delete last char of tList
put tList into fld pFldName
Chipp Walters wrote:
> Looking for some help.
> I have a list field and want to add an elipsis (...) at the end of lines
> which are truncated and won't fit in the field. I was wondering if
> anyone out there may have a function to do this quickly?
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.4 - Release Date: 12/22/2004
More information about the use-livecode