I was very mistaken.
I now do this:
m_textAttributes = [NSDictionary dictionary];
[m_textAttributes setObject:[NSFont systemFontOfSize:12.0]
forKey:NSFontAttributeName];
NSMutableParagraphStyle *pStyle = [[NSMutableParagraphStyle new]
autorelease];
[pStyle setAlignment:NSRightTextAlignment];
[m_textAttributes setObject:pStyle
forKey:NSParagraphStyleAttributeName];
However the text is not right justified when I do:
[m_obstacleName drawInRect:cellFrame withAttributes:m_textAttributes];
Is this the correct way to right justify text in an NSTextFieldCell?
-koko
On Oct 9, 2010, at 1:19 PM, Ken Thomases wrote:
On Oct 9, 2010, at 2:05 PM, [email protected] wrote:
I want to make a NSDictionary of text attributes to apply to text
being drawn in a NSTextFieldCell.
This
m_textAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont systemFontOfSize:12.0], NSFontAttributeName,
NSRightTextAlignment, NSTextAlignment, nil];
gives this error:
error: syntax error before 'NSTextAlignment'
NSRightTextAlignment is not an object and so can't be stored in a
dictionary. You could wrap it in an NSNumber. I don't know to what
purpose you intend to put the resulting dictionary. That ultimate
use would dictate whether an NSNumber can be used.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]