Shy hand cursor for links in NSTextView
Shy hand cursor for links in NSTextView
- Subject: Shy hand cursor for links in NSTextView
- From: Paul Collins <email@hidden>
- Date: Thu, 4 Jan 2007 08:51:26 -0800
How do I get the hand cursor to consistently appear over links in an
NSTextView? I'm 90% of the way there, but when the window containing
the view is first opened, the cursor remains an I-beam until the
mouse has moved out of and back into the view. Why should that matter?
The window's initialFirstResponder is set to my NSWindowController's
subclass, so I can forward on mouseMoved events to the NSTextView
without clicking. setAcceptsMouseMovedEvents is set after loading the
nib containing the window. The NSTextView is selectable but not
editable.
I create the links like this...
NSMutableAttributedString * _whoisDisplayString;
NSMutableAttributedString *whoisLine =
[[NSMutableAttributedString alloc] initWithString:theLine];
[whoisLine addAttribute:NSLinkAttributeName value:[theLine
substringWithRange:emailAddressRange] range:emailAddressRange];
[_whoisDisplayString appendAttributedString:whoisLine];
[[whoisSearchResults textStorage]
setAttributedString:_whoisDisplayString];
If you want to see it in action, download the previous version of
this app, Who's There?, and use the "Who's There?" button on a log
event. http://www.opendoor.com/whosthere/WhosThereDownload.html
(filling the form is optional). I've improved on this version, but
still have the bug described above.
I can see the mouseMoved events being forwarded to the NSTextView, it
just seems to ignore them (not change to hand cursor) at first. Any
ideas?
Thanks,
Paul Collins
** Gracion Software LLC http://www.gracion.com/
** Tel: +1 (541) 488-3488 iChat/AIM/Skype: gracionsoft
** DigiTunnel 1.4 PPTP/VPN client for OS X
** Pronto Patent - search/download US patents fast
** And check out: http://www.opendoor.com/doorstop/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden