• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Links in NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Links in NSTextField
      • From: Uli Kusterer <email@hidden>
References: 
 >Links in NSTextField (From: Dimitri Bouniol <email@hidden>)
 >Re: Links in NSTextField (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Tiger apps on Panther
  • Next by Date: Problem in scrolling a window.
  • Previous by thread: Re: Links in NSTextField
  • Next by thread: Re: Links in NSTextField
  • Index(es):
    • Date
    • Thread