Re: URLs in TextView: success
Re: URLs in TextView: success
- Subject: Re: URLs in TextView: success
- From: Arno Gourdol <email@hidden>
- Date: Wed, 9 May 2001 12:18:27 -0700
I am overcome with joy! I finally got the URLs links in a NSTextView to
work. Thanks to Dan Wood and Peter Ammon for their help.
A few caveats:
- The link object in the textView:clickedOnLink:atIndex message is a
NSString, not a NSURL. So your delegate needs to look like this:
- (BOOL)textView:(NSTextView*)inTextView
clickedOnLink:(id)inLink
atIndex:(unsigned)inCharIndex {
return [[NSWorkspace sharedWorkspace]
openURL: [NSURL URLWithString: inLink]];
}
- The value of the HREF attribute of the A tag must specify the scheme.
In web pages http: is assumed, but not here. So use
href="
http://www.apple.com/" instead of href="www.apple.com". Note that
you can also use mailto: and that will correctly open Mail. Sweet!
- The NSTextView in IB must have the Is Selectable attribute set :-(
- As previously noted, unfortunately, there is no cursor feedback when
the user is over a link :-(
- Some entity references are supported (© é) but others
aren't (&em;).
Arno.