Re: Clipping drawn text with an ellipsis
Re: Clipping drawn text with an ellipsis
- Subject: Re: Clipping drawn text with an ellipsis
- From: Brian Webster <email@hidden>
- Date: Wed, 12 Jun 2002 09:41:47 -0500
Well, there is a way to do it, but unfortunately it's not
actually implemented yet. If you want to tease yourself, look
in NSParagraphStyle.h and feast upon the
NSLineBreakByTruncatingTail enum declaration towards the top.
Then move your eyes over to the right and see the comment that
says "doesn't work yet". :( In theory, you'd be able to pass
this in as the paragraph style attribute for your string and
Cocoa would do it for you, but alas, not as of yet.
However, I think there is a method in the Omnigroup's OmniAppKit
framework that may do what you want. I'd suggest downloading it
and looking in Foundation->Cocoa Class
Categories->NSAttributedString, where you'll find a method that
does the ellipsis drawing thing.
On Wednesday, June 12, 2002, at 12:07 AM, cocoa-dev-
email@hidden wrote:
I'm drawing text using NSString's drawInRect:withAttributes: method.
This method wraps the text onto multiple lines if it doesn't fit within
the width of the given rectangle. What I want to do is have the text
clipped to the edge of the rectangle with an ellipsis (...) appended, a
la the OS 9 Finder with filenames. (The OS X Finder, of course, is
super clever and puts the ellipsis in the middle, but I don't
need that.)
Anyone know if there is a simple way to do this? I'm trying to avoid
rolling my own routine to do the job and thereby reinventing the wheel.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.