Testing NSLineBreakByTruncatingTail
Testing NSLineBreakByTruncatingTail
- Subject: Testing NSLineBreakByTruncatingTail
- From: "Paul G. Fitzgerald" <email@hidden>
- Date: Tue, 16 Dec 2003 00:29:25 -0600
I'm testing NSLineBreakByTruncatingTail on Panther. I haven't had any
luck. I'm trying to get the contents of an NSTableView to use the
style.
There's a test project here:
http://homepage.mac.com/pgfitzgerald
Has anyone been able to get it to work?
Paul
On Dec 15, 2003, at 11:47 AM, Paul G. Fitzgerald wrote:
Jon,
Thanks a bunch. That's exactly what I needed!
I suppose I could use this same technique to truncate long cell
content using ellipses... that is, unless NSLineBreakByTruncatingTail
has started working.
Paul
On Dec 15, 2003, at 11:00 AM, Jonathan Wight wrote:
I've put a new version of the code online that pretty much 'just
works' (famous last words). The vanishing act was because I was using
-[NSTextActionCell attributedStringValue] which sets the font colour
to white and doesn't seem to take into account the selection state of
the cell. So instead I created my own text attributes dictionary and
get the cell's stringValue and draw it myself. (What I should
probably do is override attributedStringValue instead).
This version works fine. I'm using a space character as the delimiter
between the date and the time (so you can use a normal formatter)
although maybe something explicit like a semicolon would be better.
I'm also not drawing the time if the column is too small. I'm also
taking into account the cell's font and background/foreground colours
(although is the cell is selected I use -[NSColor
alternateSelectedControlTextColor]).
The only problems I can see now is if the cell was to use a
NSDateFormatter that returns an attributed string (the attributes
would be ignored) and I have no clue how this would look on machines
with right to left languages.
Jon.
On Dec 15, 2003, at 01:04, Jonathan Wight wrote:
Actually this looks like the way to do it. As an experiment I just
implemented it this way:
http://homepage.mac.com/jwight/ and grab DateTimeTest.tar.gz (XCode
needed - but binary & source provided)
In the table enter a date in the format "1/1/1 1:1:1" and hit return.
For some reason the field likes to blank itself out (not sure why)
but
if you click the table column line and expand/shrink the column you
see
the desired effect.
The way it works is I've got a hard coded character sequence in the
format string for the date (so it looks like "%m/%d/%y\t%H:%M:%S"
now)
and then in the drawInteriorWithFrame:inView: I'm splitting the
cell's
attributedString up into left and right components and drawing each
component flush against the relevent side of the cell.
Maybe there is an easier way to do this - but apart from the
unexplained blanking it seems to work well. Good luck fixing the
blanking!
Jon.
On Dec 15, 2003, at 00:32, Jonathan Wight wrote:
You should be able to do it by providing your own
NSTextCell/NSActionTextCell subclass and overriding
"drawInteriorWithFrame:inView:". Perhaps. ;-)
Jon.
On Dec 15, 2003, at 00:07, Paul G. Fitzgerald wrote:
Jon,
If the "Date Received" column in Mail.app is sufficiently widened,
the
Date is left aligned, and the time is right aligned. I'd like to do
the same thing with my date column.
I'm guessing it's not going to be easy... :-)
Paul
On Dec 14, 2003, at 11:53 PM, Jonathan Wight wrote:
Hi Paul,
What exactly are you trying to accomplish. The "Date Received"
column
in Mail.app looks just like any other column to me...
Jon.
On Dec 14, 2003, at 16:01, Paul G. Fitzgerald wrote:
I've got a column in an NSTableView that needs to behave like the
"Date Received" column in Apple's Mail. I've tried adding a right
tab to an NSAttributedString, but it's not working. Am I even on
the
right track?
Thanks,
Paul G. Fitzgerald
_______________________________________________
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.
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.