• 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: Chris Suter <email@hidden>
  • Date: Thu, 24 Aug 2006 19:52:16 +1000


On 24/08/2006, at 7:45 PM, 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.


In my case it wasn't really an important enough feature that I pursued it beyond that (lots of other things to finish in the app first). If you have static text, you could probably try loading HTML into an attributed string. That works for the about panel, so maybe that works automatically. Or maybe the about panel delegate does it, in which case you're stuck again...

It might also be worth searching the net, maybe there's source code available via koders or so that does this and shows how it's done.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de

We got it to work with a NSTextField. We subclassed NSTextField and from there you can set the attributes on the cell to get it to be displayed in blue, with an underline and there's an attribute so the cursor turns into a hand. You have to handle the mouseDown event yourself I think. I'll check with my colleagues and see if we can post the code.


- Chris

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

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

  • Prev by Date: Re: Links in NSTextField
  • Next by Date: Re: nibs, subclassing nsview
  • Previous by thread: Re: Links in NSTextField
  • Next by thread: Re: Links in NSTextField
  • Index(es):
    • Date
    • Thread