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 16:35:53 -0700
Hello...
A minor addition to the notes on pretending to not allow selection in
a "selectable" NSTextView, you might also want to get rid of the
I-Beam cursor for the rest of the text.
In the simple case where the only cursor attributes that are
important are the ones set for the NSTextView linkAttributes
dictionary, you can just set the default cursor for all of the text
to the arrow cursor in awakeFromNib, after the string has been set in
the NSTextView (since the link attributes dictionary will override
the existing attributes of the text).
NSTextStorage *storage = [yourTextView textStorage];
NSRange all = NSMakeRange(0,[storage length]);
NSCursor *arrow = [NSCursor arrowCursor];
[storage addAttribute:NSCursorAttributeName value:arrow range:all];
Otherwise, if you need to preserve any existing cursor attributes in
the text, it becomes a bit more complicated.
If you are parsing the existing content of the NSTextView to set
multiple custom cursors, it wouldn't be too much more difficult to
set a default cursors for the rest of the text. If you are creating
NSAttributedString by reading data from a file, etc, using
@"DefaultAttributes" in the options to set the default cursor
attribute makes things a bit easier.
Louis
_______________________________________________
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.