Re: URL formatting in NSAttributedString
Re: URL formatting in NSAttributedString
- Subject: Re: URL formatting in NSAttributedString
- From: "Louis C. Sacha" <email@hidden>
- Date: Sat, 26 Jun 2004 15:25:23 -0700
Hello...
NSTextView should handle changing the cursor to the one specified
with the NSCursorAttributeName key automatically.
One caveat that I have run into is that the text in the NSTextView
must be selectable in order for the cursor attributes of text to work
at all. If it would work better if your NSTextView is unselectable,
you can fake "un-selectability" in a NSTextView that allows selection
by changing the attributes used for selected text and using one of
the NSTextView delegate methods.
You will need to have a delegate for the NSTextView that implements
the following method
- (NSRange)textView:(NSTextView *)aTextView
willChangeSelectionFromCharacterRange:(NSRange)oldSelectedCharRange
toCharacterRange:(NSRange)newSelectedCharRange
{
return oldSelectedCharRange;
}
And you will need to change the attributes used by the NSTextView for
selected text to an empty dictionary using the
setSelectedTextAttributes:, usually in the awakeFromNib method of the
nib owner.
[yourTextView setSelectedTextAttributes:[NSDictionary dictionary]];
If you already have the NSTextView set as selectable, then there must
be some other problem. If you post a few more details about what you
are trying to do (or code), it would help to narrow down the possible
causes.
Hope that helps,
Louis
> This topic seems to come up frequently on the list (or maybe just more
often than usual recently), so if you search the archives for
"NSLinkAttributeName " you will probably be able to find even more
info if you need it.
Argh. This actually did fix my issue with colors -- for which I am
very happy -- but I still cannot seem to get the cursor to work. Does
the "NSCursor" field in link attributes actually work in an NSTextView,
or do I need to muck about with cursor boxes and suchnot?
--
Rachel 'Sparks' Blackman -- sysadmin, developer, mad scientist
"If it is not broken, give me five minutes to redesign it!"
_______________________________________________
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.