• 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: NSLayoutManager question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSLayoutManager question


  • Subject: Re: NSLayoutManager question
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 20 Feb 2002 09:57:20 -0800

On Tuesday, February 19, 2002, at 05:56 PM, Paul Bayley wrote:

I wish to change the text area selection behavior of a Cocoa application and I'm a bit lost. I believe this is handled by NSLayoutManager but not certain. I'm sure somebody will correct me if I'm wrong.

The behavior I wish to change is when selecting text via dragging I do not want to select the trailing hard return (linefeed). The current behavior selects the linefeed when selecting right or down. I do not wish to change the triple-click behavior which selects a line including the trailing linefeed.

I also want to create a click-and-hold gesture as well as a drag-the-selection gesture, but those are secondary concerns.

It seems to me, browsing Apple's documentation, that the selection behavior is performed by NSLayoutManager. However I'm not quite sure how to alter the behavior of NSLayoutManager to my liking.

No, this behavior is determined by NSTextView, primarily in its mouseDown: method. NSTextView is the view, NSTextStorage the model (or part of it), and NSLayoutManager the controller; this is view behavior. NSLayoutManager is consulted, primarily through glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:, and you could consider intervening there, but the primary responsibility lies with NSTextView. (glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph: is not the right method to override, however; see the NSLayoutManager header for details.)

Possibly someone else on the list has tried to do something like this before.

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.

  • Follow-Ups:
    • Re: NSLayoutManager question
      • From: Paul Bayley <email@hidden>
References: 
 >NSLayoutManager question (From: Paul Bayley <email@hidden>)

  • Prev by Date: Double clicking rows vs. column headers
  • Next by Date: Re: Please explain this error message...
  • Previous by thread: NSLayoutManager question
  • Next by thread: Re: NSLayoutManager question
  • Index(es):
    • Date
    • Thread