Re: Cursor over links in NSTextView
Re: Cursor over links in NSTextView
- Subject: Re: Cursor over links in NSTextView
- From: Rainer Brockerhoff <email@hidden>
- Date: Tue, 4 Dec 2001 14:44:05 -0200
Date: Mon, 03 Dec 2001 22:30:20 -0600
From: Donald Brown <email@hidden>
I got my code working that uses NSScanner to recognize URLs and add a
NSLinkAttribute as well as highlighting the URL, and clicking on the URL
will launch the url as appropriate. (After cleaning up the code, I'll be
releasing it somewhere appropriate.) But I've still got an I-bar cursor
when the mouse moves over the link. Is there any way to tell the system to
switch to another cursor when the mouse moves over a link?
You need to call -[NSView addCursorRect: cursor:] for each link's
rectangle. I nearly got this to work, and gave up after some tries.
Later I realized that you can't find out the glyph boundaries for
each link without having the complete text rendered first; as I was
trying to set everything up before showing anything, it didn't work.
I'm not sure how to have the layout manager render the whole text
without displaying it and not flashing something on the screen.
Sorry for the sketchy tip, I'll return to this in a couple of weeks...
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"Originality is the art of concealing your sources."
http://www.brockerhoff.net/ (updated Dec. 2001)