Re: How to support clicks in a non-selectable NSTextView?
Re: How to support clicks in a non-selectable NSTextView?
- Subject: Re: How to support clicks in a non-selectable NSTextView?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 8 Jul 2002 11:22:52 -0700
On Monday, July 8, 2002, at 06:55 AM, Brian Webster wrote:
There are two ways I can think of that you could go about it. The
first would be to make the view not selectable and try to handle clicks
on URLs yourself. This would mean making a subclass of NSTextView and
overriding mouseDown: and mouseUp:, finding the bounding rectangles of
the URLs via NSLayoutManager, etc. The second would be to set the
selectable flag to YES but then disable everything you'd want to
disable. You could make the text selection color the same as the
background color so it wouldn't show up, override copy:, cut:, the drag
routines, and so on.
You're making things too difficult. The cleanest way to do this would
be to make the view selectable, set the selection to {0, 0}, and refuse
all selection changes using the delegate method
- (NSRange)textView:(NSTextView *)textView
willChangeSelectionFromCharacterRange:(NSRange)oldSelectedCharRange
toCharacterRange:(NSRange)newSelectedCharRange;
Douglas Davidson
_______________________________________________
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.