Truncate Text Based On Available Space?

dunbarx at aol.com dunbarx at aol.com
Wed Jun 12 21:44:26 EDT 2013


Scott.


This is a Kluge and a half, but I filled a field with some text. In a button script:



on mouseUp
   ask "What length to trunc?"
   if it is not an integer then exit mouseup
   click at the left of fld 1 + it & "," & the top of fld 1 + 12
   put "..." into char (word 2 of the selectedChunk)  to 10000 of fld 1
end mouseUp


Is this anything like you wanted? Of course the subsequent text is lost, though it could be saved somewhere. And I only dealt with the first line, since I hard coded the vertical dimension (12) of the click location. But I can see it being extended anywhere in the field.


Craig Newman



-----Original Message-----
From: Scott Rossi <scott at tactilemedia.com>
To: LiveCode Mail List <use-livecode at lists.runrev.com>
Sent: Wed, Jun 12, 2013 9:15 pm
Subject: Truncate Text Based On Available Space?


Has anyone created a routine that will truncate text in a field to given
pixel width, and append ellipses?

I found one that limits text based on character count, but I'm looking to
limit based on available space.

Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list