Re: HTML link from TextView
Re: HTML link from TextView
- Subject: Re: HTML link from TextView
- From: email@hidden
- Date: Mon, 4 Mar 2002 18:37:16 -0800
In some Carbon programs, I have seen the ability to control click on a
http link from a text view that results in opening said link in the
default browser. Is there something that will do some or all of this
under Cocoa? I'm mostly concerned with parsing
out the clicked link. As of now, the closest thing I have come across
is a double click selecting one section (separated by /'s) of an html
link. Any ideas?
If the parsing out of the links is your primary concern, a simple
regex expression or two should do the trick for you.
TextEdit-compatible regex solutions was a recent topic, look in the
archives for that. I believe Mike Ferris' TextExtras was recommended,
but that's just a vague memory.
Mail.app clearly has a solution in this area, but I believe the
parsing part is not public. However, once it has parsed out the links I
believe it uses a public solution to display and follow them, which is
the ability of NSTextView to "follow" links by messaging the user's
browser whenever a link is clicked on (no control key needed). The
links must be marked with NSLinkAttributeName, however, which gets us
back to the parsing issue. You also want to make them blue and
underlined, setting a URL value for NSLinkAttributeName does not
automatically set up the text to display the way links typically do.
I believe there is also a little utility on the web named something
like "ice coffee" (with a weird capitalization) that patches the system
somehow to provide this service for free in all Cocoa apps, if that's to
your liking. I just found it at
http://www.versiontracker.com/moreinfo.fcgi?id=13381&db=mac.
Best of luck...
Ben Haller
Stick Software
_______________________________________________
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.