Re: Trimming text in a tableview
Re: Trimming text in a tableview
- Subject: Re: Trimming text in a tableview
- From: Ryan Stevens <email@hidden>
- Date: Thu, 5 Jun 2003 13:21:31 -0700
On Thursday, June 5, 2003, at 06:46 AM, Clark S. Cox III wrote:
On Thursday, Jun 5, 2003, at 09:03 US/Eastern, Obi One wrote:
Hi,
I'm searching a way to have "trimmed" or "truncated"
text (it's maybe not the right words)in my tableview
cells.
I would like to have the same trimmed text like Safari
has in the bookmark lists. When the text is too long,
after resizing the column for example, the displayed
string is something like "hello...you ?", with "..."
in its middle.
I think the solution is simple but i really don't know
where to search :)
If I were trying to do this, I'd probably make a custom subclass of
NSTextFieldCell that draws using the behavior you describe (i.e. check
the strings width against the cell's width, take out some characters
in the middle, repeat until the string fits.), and use that as the
dataCell of my table columns.
If it hasn't been mentioned, see:
http://www.cocoadev.com/index.pl?TruncatingStringsInTableView
I stumbled on that the other day when looking to do the same exact
thing. Took me about 2 minutes to get it working in my table.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.