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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to