• 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: NSTextField and clickable link
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField and clickable link


  • Subject: Re: NSTextField and clickable link
  • From: Andy Lee <email@hidden>
  • Date: Sat, 21 May 2005 14:42:33 -0400

On May 21, 2005, at 2:22 PM, Steve Palmer wrote:
Actually, in case I wasn't clear, I did code this and it didn't work. And I did search the archives but I only saw one message and no reply. I'll look again. A google search also doesn't seem to turn up any solution either.

Here's the extract from the code.

    NSMutableAttributedString * newTitleString = [[NSMutableAttributedString alloc] initWithString:@"Apple's Web Site"];
    NSRange attrRange = NSMakeRange(0, [newTitleString length]);
    [newTitleString addAttribute:NSLinkAttributeName value:@"http://www.apple.com"; range:attrRange];
    [textField setAttributedStringValue:newTitleString];

Looks like you're almost there -- just missing a call to -setAllowsEditingTextAttributes:, according to this:


<http://lists.apple.com/archives/cocoa-dev/2005/May/msg00069.html>

But I notice the doc for that method says: "You can change text attributes programmatically regardless of this setting." Maybe that's a case of the doc not being correct?

BTW, the search terms I used were "nstextfield link," in case you want to research further. I think I chose the option to sort results by date.

HTH,
--Andy

_______________________________________________
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: NSTextField and clickable link
      • From: Steve Palmer <email@hidden>
References: 
 >NSTextField and clickable link (From: Steve Palmer <email@hidden>)
 >Re: NSTextField and clickable link (From: Andy Lee <email@hidden>)
 >Re: NSTextField and clickable link (From: Steve Palmer <email@hidden>)

  • Prev by Date: What does "NS" means ?
  • Next by Date: Re: What does "NS" means ?
  • Previous by thread: Re: NSTextField and clickable link
  • Next by thread: Re: NSTextField and clickable link
  • Index(es):
    • Date
    • Thread