• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView's MarkedText
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSTextView's MarkedText
      • From: Gordon Apple <email@hidden>
References: 
 >Re: NSTextView's MarkedText (From: Gordon Apple <email@hidden>)

  • Prev by Date: Re: NSTextView's MarkedText
  • Next by Date: Re: Non-sandboxed Cocoa app accessing current user preferences using NSTask fails when launched outside Xcode.
  • Previous by thread: Re: NSTextView's MarkedText
  • Next by thread: Re: NSTextView's MarkedText
  • Index(es):
    • Date
    • Thread