Re: Links in NSTextField
Re: Links in NSTextField
- Subject: Re: Links in NSTextField
- From: Michael Nickerson <email@hidden>
- Date: Thu, 24 Aug 2006 10:47:54 -0400
On Aug 24, 2006, at 5:45 AM, Uli Kusterer wrote:
Am 24.08.2006 um 07:47 schrieb Dimitri Bouniol:
How can I programatically make an NSTextField into a hyperlink?
I wasn't able to get it to work. The closest I got was replacing
my NSTextField with an NSTextView. Then I could set its text to an
attributed string on which I'd set the link attribute to an NSURL.
However that only displayed correctly, it didn't actually respond
to clicks. I tried to override -textView:clickedOnLink:atIndex:,
but for some reason that didn't seem to get called.
It works with an NSTextField. Set its attributed string value. You
then just need to set it to be selectable (you can keep it non-
editable), otherwise it doesn't respond to clicks.
Though you won't get the nice pointing hand cursor without subclassing.
It's probably the same deal with NSTextView, although I haven't tried
setting a link in one so take that with a grain of salt.
Darkshadow
(aka Michael Nickerson)
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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