How to display NSStrokeColorAttributeName on the NSColorPanel
How to display NSStrokeColorAttributeName on the NSColorPanel
- Subject: How to display NSStrokeColorAttributeName on the NSColorPanel
- From: Leonardo <email@hidden>
- Date: Sat, 01 Feb 2014 10:37:59 +0100
- Thread-topic: How to display NSStrokeColorAttributeName on the NSColorPanel
When my 1st NSColorWell is active and I change the selection in my
NSTextView, both NSColorWell and NSColorPanel display the foreColor of the
selected tex. That's fine.
Now I have a second NSColorWell that should display the strokeColor (or any
other color) of the selected text. But I can't yet succeed. I my NSTextView
subclass I have coded, unsuccessfully:
- (void)textViewDidChangeSelection:(NSNotification*)aNotification
{
NSRange selRange = [self selectedRange], effRange;
NSDictionary *attributes = [self.textStorage
attributesAtIndex:selRange.location effectiveRange:&effRange];
if(attributes){
NSColor *strokeColor = [attributes
objectForKey:NSStrokeColorAttributeName];
if(strokeColor){
[oStrokeColorWell setColor:strokeColor];
}
}
}
Even if the strokeColor exists and gets set to the oStrokeColorWell, the
oStrokeColorWell still displays the foreColor. Any idea?
Regards
-- Leonardo
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden