• 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: Paul Bayley <email@hidden>
  • Date: Wed, 20 Feb 2002 12:24:36 -0800

At 9:57 AM -0800 2/20/02, Douglas Davidson wrote:
>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


Nobody on this list has tried this.

I'm not clear what the selection process is then. I know NSTextView knows where the mouseDown occurs, but I thought it passed that information to NSLayoutManager so it could make the selection. For example if one document spans two views (like page 1+2) how would NSTextView know what to select? I thought that each view would report each end of the selection to NSLayoutManager which would perform the selection (not only visually but also creating a text range).

So what do I override?
_______________________________________________
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: Douglas Davidson <email@hidden>
References: 
 >Re: NSLayoutManager question (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: regex in strings
  • Next by Date: Re: Accessor called once, fires twice
  • Previous by thread: Re: NSLayoutManager question
  • Next by thread: Re: NSLayoutManager question
  • Index(es):
    • Date
    • Thread