Got a small issue that been nagging at me. I wonder if anyone can help.
I use the function listed below from Livecode to truncate my text fields. However, if there is a long word at the end of the field the Truncating is not performed on the text.
Apparently, this method only works if there are spaces in the text. i.e If there was a field with "supercallafraggerlisticxpallydoeus" no truncating would take place. Can someone offer or hint at a way to work around this limit. I considered introducing spaces to the long words. But does not seem very intuitive. Maybe I am missing something.
Thanks for your time.
Code: Select all
function truncatedToFit pString, pWidth
local tTruncatedLine
create invisible field
set the width of last field to pWidth
put pString into last field
put line 1 of the formattedText of last field into tTruncatedLine
delete last field
send "choose browse tool" to me in 1 millisecond
if tTruncatedLine is not pString then put "..." after tTruncatedLine
return tTruncatedLine
end truncatedToFit