• 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: Color of string with link attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color of string with link attribute


  • Subject: Re: Color of string with link attribute
  • From: Jeremy Dronfield <email@hidden>
  • Date: Thu, 17 Jun 2004 09:41:56 +0100

If you're coding for 10.3, you can subclass NSTextView and override -linkTextAttributes. Return an empty dictionary if you want the linked text to have whatever style attributes you dictate when you create the link, or return a dictionary containing the attributes you want all your links to have. Or a mixture of both. For example, I have an application which colour-codes hyperlinks according to whether they're file:, http: or local in-application links. The NSForegroundColorAttributeName is applied to the text when the link is created, and -linkTextAttributes returns [NSDictionary dictionaryWithObject:[NSCursor pointingHandCursor] forKey:NSCursorAttributeName], which is common to all hyperlinks.

Regards,

-Jeremy

===================================
SkoobySoft, home of viJournal
email: email@hidden or visit:
http://freespace.virgin.net/jeremy.dronfield/skoobysoft.html
===================================

On 17 Jun 2004, at 12:12 am, Nils Hjelte wrote:

When you add the attribute NSLinkAttributeName to a attributed string
it becomes blue (and underlined) no matter what color is chosen using
NSForegroundColorAttributeName. Is there some way to override the
default link color? Could someone tell me if this is a designed
restriction (and why so) or if it is a bug?

// Nils Hjelte

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: Color of string with link attribute
      • From: Douglas Davidson <email@hidden>
References: 
 >Color of string with link attribute (From: Nils Hjelte <email@hidden>)

  • Prev by Date: Re: NSUndoManager in non-NSDocument Cocoa Applications: unable to change 'Undo' menu item name.
  • Next by Date: stale NSURLConnections
  • Previous by thread: Color of string with link attribute
  • Next by thread: Re: Color of string with link attribute
  • Index(es):
    • Date
    • Thread