• 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: Damian Terentyev <email@hidden>
  • Date: Tue, 24 Oct 2006 11:33:57 +0400

Good day!
I wanted to see the mentioned example, but is seems to be absent in my examples folder (On 10.3).
If it doesn't use any 10.4-specific features, maybe you could probably send it to me, if you don't mind?


Yours sincerely,
Damian/Three-eyed Fish

On Oct 23, 2006, at 20:22, Douglas Davidson wrote:


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: Douglas Davidson <email@hidden>
    • Re: Re: Text character under the mouse cursor in an NSTextView
      • From: "Alan Smith" <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>)
 >Re: Text character under the mouse cursor in an NSTextView (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Focus Rings
  • Next by Date: Re: Focus Rings
  • Previous by thread: Re: Text character under the mouse cursor in an NSTextView
  • Next by thread: Re: Re: Text character under the mouse cursor in an NSTextView
  • Index(es):
    • Date
    • Thread