Re: Programatically create URLs in NSTextView or ??
Re: Programatically create URLs in NSTextView or ??
- Subject: Re: Programatically create URLs in NSTextView or ??
- From: Douglas Davidson <email@hidden>
- Date: Tue, 6 Sep 2005 11:09:50 -0700
On Sep 5, 2005, at 9:20 PM, RameshPVK wrote:
You can do this by setting the attributes to the attributed string.
You can find the list of attributes in the NSAttributedString
Additions in Appkit. And now coming to set a text as URL you need
to do the following :
1) get the range of text
2) to that range set the following properties :
NSForegroundColorAttributeName and NSLinkAttributeName to set the
link object.
3) The hand cursor for the URL can be achieved by implementing the
following method
It should suffice to set NSLinkAttributeName on the range in
question. An NSTextView has a set of linkAttributes that are
automatically applied to links; by default these include coloring,
underlining, and the appropriate cursor. The value of the attribute
may be an NSString or an NSURL, and the text view will automatically
open it when clicked on; alternatively, you may use the delegate
method to be notified of clicks, and make the value of the attribute
whatever you choose.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden