On 29 Dec 2004, at 18:00, [EMAIL PROTECTED] wrote:

Message: 1
Date: Tue, 28 Dec 2004 20:08:02 -0800
From: Chipp Walters <[EMAIL PROTECTED]>
Subject: Re: function to calculate string length...
To: Discussions on Metacard <metacard@lists.runrev.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thanks for this, would you mind explaining what it does?

Thanks again
Chipp

Chipp, sorry for the delayed response due to festivities.
My other handler is using the difference in number of lines of a field and the number of lines of the formattedtext of the same field if the text is "wrapped". And it is useless if the words in the list field are very long and the width of the field is very small (as it uses the word wrap done by the engine).
Hugh also pointed out that the character used for the ellipsis is differently mapped in windows and mac.
Mac uses the numtochar(201) while windows uses numtochar(133) (according to Hugh).
So back to the use of the normal 3 points and optimizing your original handler.
May be you did it already this way then disregard this one.


on formatFld pFldID
put 20 into fineTune ### adjust to taste
put (the width of fld id pFldID) - fineTune - scrollbarwidth of fld id pFldID into tW
repeat with i = 1 to the num of lines in fld id pFldID
repeat with y = 1 to the num of chars in line i of fld id pFldID
if the formattedwidth of char 1 to y of line i of fld id pFldID >= tW then
put char 1 to y - 1 of line i of fld id pFldID & "..." & cr after tList
exit repeat
else if y = the num of chars in line i of fld id pFldID then
put line i of fld id pFldID & cr after tList
exit repeat
end if
end repeat
end repeat
put tList into fld id pFldID
end formatFld


(beware of the mail-linewraps)
Greetings,
WA

_______________________________________________
metacard mailing list
metacard@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/metacard

Reply via email to