• 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: Text character under the mouse cursor in an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text character under the mouse cursor in an NSTextView


  • Subject: Re: Text character under the mouse cursor in an NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 23 Oct 2006 09:22:53 -0700


On Oct 22, 2006, at 12:10 AM, Damian Terentyev wrote:

You can get the location of the character under mouse cursor with NSTextView's characterIndexForPoint:[NSEvent mouseLocation].
Just subclass it to catch mouse events. And after getting the character you may check whether it is English of Hiragana/Katakana/ CJK Unified Ideograms, but I do not know whether Cocoa has any convenient ways to do it. Anyhow, you may use Unicode ranges. For example, CJK Unified ideographs (most Chinese/Japanese/Korean characters) are 4e00 to 9fa5 as I can see in the Character Palette.

I generally recommend not using characterIndexForPoint: for anything other than the input method purposes it is intended for. Take a look at the MouseOverTextView class in the LayoutManagerDemo sample code; I believe that should be pretty much directly on point here.


Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Text character under the mouse cursor in an NSTextView
      • From: Damian Terentyev <email@hidden>
References: 
 >Text character under the mouse cursor in an NSTextView (From: Dimitri Bouniol <email@hidden>)
 >Re: Text character under the mouse cursor in an NSTextView (From: Damian Terentyev <email@hidden>)

  • Prev by Date: Re: NSTextView's -setTextContainerInset: issues
  • Next by Date: How to change standard user to administrator type
  • Previous by thread: Re: Text character under the mouse cursor in an NSTextView
  • Next by thread: Re: Text character under the mouse cursor in an NSTextView
  • Index(es):
    • Date
    • Thread