Re: Creating a clickable (web-browser-like) URL control
Re: Creating a clickable (web-browser-like) URL control
- Subject: Re: Creating a clickable (web-browser-like) URL control
- From: John Anderson <email@hidden>
- Date: Fri, 2 Aug 2002 09:03:38 -0700
The best way would be to create an NSTextView and populate its contents
dynamically. Let's say for example that you reference it with an
instance variable called myTextField. Put the following into your
awakeFromNib method:
NSString *htmlString = @"<a href=\"
http://www.apple.com/\">Neato
Link</a>";
[[myTextField textStorage]
setAttributedString:[[[NSAttributedString alloc] initWithHTML:[NSData
dataWithBytes:[htmlString cString]
length:[htmlString length]] documentAttributes:nil]
autorelease]];
That should display a clickable link. I think there's even a way to
make NSTextView display the finger cursor over the link. Don't remember
off-hand.
John
John Anderson
On Thursday, August 1, 2002, at 12:18 PM, Sean McBride wrote:
I'm looking to put a web-browser-like URL link in my about box, like
how
the QT pref pane does it. I don't see anything like this in Interface
Builder, so I guess there is no built-in class. I imagine something
like
this should not be too hard. Can someone point me to an exsiting
sample
or give me a clue where to start.
From what I can tell, NSTextField will let me make the text blue, but
not
underlined, and there is nothing to make it act like a button. And
NSButton doesn't seem to allow a button that is just text.
Thanks for any help!
_______________________________________________
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.