Re: NSTextField and clickable link
Re: NSTextField and clickable link
- Subject: Re: NSTextField and clickable link
- From: Steve Palmer <email@hidden>
- Date: Sat, 21 May 2005 15:19:07 -0700
Hmm... Apparently this only works if the NSTextField is editable. If
I make it non-editable, it doesn't work. Is this by design?
- Steve
On May 21, 2005, at 11:42am, Andy Lee wrote:
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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