• 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: How is "Apple + Ctrl + D" implemented?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is "Apple + Ctrl + D" implemented?


  • Subject: Re: How is "Apple + Ctrl + D" implemented?
  • From: "Ying Bian" <email@hidden>
  • Date: Mon, 28 Apr 2008 21:25:38 +0800

Graham,

Thanks so much.  I will try it out based on your suggestions and will
keep the result
posted.

On Mon, Apr 28, 2008 at 6:42 PM, Graham Cox <email@hidden> wrote:
> NSTextView has this:
>
>  - (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange
> granularity:(NSSelectionGranularity)granularity
>
>  So if the proposedSelRange is a zero-length range at the character index
> determined before, and granularity is NSSelectByWord, it should return the
> range of the word.
>
>  hth,
>
>  G. (still guessing ;-)
>
>
>
>  On 28 Apr 2008, at 8:06 pm, Ying Bian wrote:
>
> >
> >
> >
> > Graham,
> >
> > Thanks for your reply! But how can I "find the range of the word" given
> > the glyph index?  I just can not find an API doing so.
> >
> > So I don't think this is the underlying implementation.  Any comments
> > from others?
> >
> > On Mon, Apr 28, 2008 at 2:51 PM, Graham Cox <email@hidden>
> wrote:
> >
> > > I imagine it uses some API such as NSLayoutManager's:
> > >
> > > - (NSUInteger)glyphIndexForPoint:(NSPoint)point
> > > inTextContainer:(NSTextContainer *)container
> > > fractionOfDistanceThroughGlyph:(CGFloat *)partialFraction
> > >
> > >
> > > One you have the glyph index you can find the range of the word it
> belongs
> > > to.
> > >
> > > One you have the string of the word it belongs to, you can look it up in
> > > dictionary.app using the Application Services API.
> > >
> > >
> > > hth, though I am guessing to some extent.
> > >
> > >
> > >
> > > G.
> > >
> > >
> >
> > --
> > B.Y.
> >
> > _______________________________________________
> >
> > 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
> >
>
>

--
B.Y.
_______________________________________________

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

References: 
 >How is "Apple + Ctrl + D" implemented? (From: "Ying Bian" <email@hidden>)
 >Re: How is "Apple + Ctrl + D" implemented? (From: Graham Cox <email@hidden>)
 >Re: How is "Apple + Ctrl + D" implemented? (From: "Ying Bian" <email@hidden>)
 >Re: How is "Apple + Ctrl + D" implemented? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSMenuItem and images
  • Next by Date: Using an NSTableHeaderView as a Custom View
  • Previous by thread: Re: How is "Apple + Ctrl + D" implemented?
  • Next by thread: Re: How is "Apple + Ctrl + D" implemented?
  • Index(es):
    • Date
    • Thread