Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

NSCursorAttributeName and NSTextView

 
   Mac (Home) -> Programmer Help RSS
Next:  [ANN] Vice - Graphical Program Priority Adjustmen..  
Author Message
Doug Brown

External


Since: Jun 25, 2005
Posts: 2



(Msg. 1) Posted: Sat Jun 25, 2005 6:54 am
Post subject: NSCursorAttributeName and NSTextView
Archived from groups: comp>sys>mac>programmer>help (more info?)

Well, I've been playing around a little bit with getting URLs in my
NSTextView to actually become clickable links. So far, so good. I set the
attributes for my attributed strings that get inserted into the text view:
NSLinkAttributeName for the link URL and NSCursorAttributeName for the
cursor that appears when hovering over the link.

Everything works fine--all my links get highlighted like links should be,
and the cursor changes when I hover over the links, except for one minor
glitch. The cursor only changes when the text view is active! So if the
first responder is my table view and I hover over a link in my text view,
the cursor stays as the I-beam.

Anyone else figured a way around this? I've found LOTS of sample code on the
internet to automatically highlight URLs, but you have to go through every
link in the text view and set up cursor rects and so forth. It seems like a
bit of a hackjob when the provided methods -almost- work. This solution I'm
using now seems so handy if I can just get it to work when the text view is
not the first responder. The link still works, but the aesthetics of the app
really bug me when the cursor doesn't change. Yes, I'm picky! Am I missing
something really obvious, like an
NSTextView -setChangesCursorOnLinksWhenNotFirstResponder: method? Wink I've
perused the docs, so I doubt it.

Thanks...

Doug
Back to top
Login to vote
Doug Brown

External


Since: Jun 25, 2005
Posts: 2



(Msg. 2) Posted: Sun Jun 26, 2005 7:58 pm
Post subject: Re: NSCursorAttributeName and NSTextView [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I went ahead and incorporated some of Apple's TextLinks sample code:

http://developer.apple.com/samplecode/TextLinks/TextLinks.html

So it took a subclass of NSTextView and overriding -resetCursorRects (also
calling -resetCursorRects manually whenever my text view's contents change).
Apple's sample code took care of the hard part--getting rects for the links.
Anyway, I still think the built-in Cocoa stuff should automatically
highlight links whether the view is active or not (or at least provide an
option to allow it), so I filed a bug. Just thought I'd let you guys know
what I was able to do to get the links working for future reference.

Doug
Back to top
Login to vote
Jøhnny_Fävòrítê

External


Since: Jun 27, 2005
Posts: 18



(Msg. 3) Posted: Mon Jun 27, 2005 1:57 am
Post subject: Re: NSCursorAttributeName and NSTextView [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Doug Brown wrote:
> I went ahead and incorporated some of Apple's TextLinks sample code:
>
> http://developer.apple.com/samplecode/TextLinks/TextLinks.html

it's too bad nobody was able to help, but that's what happens sometimes. you
can't always count on the regulars having experience with absolutely
everything.

answer or no, i'm glad you posted this, because i'll have to be writing
something similar myself pretty soon.
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Problem with NSTextView - I have an NSTextView in a drawer (it is in a tab view in the drawer, but I don't know if this has anything to do with it), and it won't update the font panel when its selection is changed. As soon as I put it on the parent window, it will. I check the....

What could cause [NSTextView setStringValue] to fail? - Hi, When I try to set the text in one of my NSTextFields, below, I get the error: [stringDisplayField setStringValue: @"Hello"]; *** -[NSTextView setStringValue:]: selector not recognized [self = 0x35efa0] stringDisplayField is a valid fiel...

Subclassing NSTextView: drawing text as soon as the view a.. - Hi folks, I am still trying to build an AddressBook-like interface; as Matt Neuburg suggested, I'm trying to do achieve this by subclassing NSTextView. I have built this NSTextView subclass, and I called it TextForm. Just for a test, I tried to put som...

Subclass of NSTextView dose not show cyrillic typing - Hello NG,    I want to enable cyrillic typing in my subclass of NSTextView.  The russian characters are not show while editing. They are there. I   know that from analyzing the string. But they are not show. Is there   a..

How to type in ASCII? - Stupid question #2 of the week. I'm trying to avoid writing a printer driver for a barcode label printer. It responds to reasonable commands, and I want to embed a command in a page that tells the printer to cut the paper. It's <STX> o STX, of c...
       Mac (Home) -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact