Re: NSTextView's MarkedText
Re: NSTextView's MarkedText
- Subject: Re: NSTextView's MarkedText
- From: Kyle Sluder <email@hidden>
- Date: Wed, 24 Jul 2013 13:46:52 -0700
On Wed, Jul 24, 2013, at 12:47 PM, Gordon Apple wrote:
> I have now added my own custom attribute, similar to markedText, and it
> seems to work as intended. However, I have run into a new problem. I
> need
> to know when selection if finished, but for some reason, my subclass of
> NSTextView can not intercept mouseUp.
NSTextView runs its own tracking loop. See "Handling Mouse Dragging
Operations":
https://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/10000060i-CH6-SW1
The plan was at that point to
> change
> my custom background attribute, deselect the text (actually, set insert
> point to end of selection), and clear my custom highlighting. Why canĀ¹t
> I
> get a mouseUp?
An alternative would be to override -mouseDown: to look something like
this:
- (void)mouseDown:(NSEvent *)theEvent {
[super mouseDown:theEvent];
[self _applyHighlightToSelection];
}
But have you considered making your highlight feature an actual
_command_ (like Bold, Italic) instead of a pseudo-selection mechanism?
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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