• 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: Sun, 22 Oct 2006 11:10:08 +0400

Good day!
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.


Yours sincerely,
Three-eyed Fish

On Oct 22, 2006, at 01:09, Dimitri Bouniol wrote:

In my application, I have a NSTextView that contains both japanese characters and english ones. I would like to know if there was a way to get only the japanese character (not an english one, or punctuation) that is under the mouse cursor, and for it to update when the cursor is moved, in that one NSTextView, so I can show it in big in another window, kind of like the dictionary app does.
Is it also possible to get the location of that character?
--
The world's biggest Apple fan,
Dimitri Bouniol
email@hidden



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


This email sent to email@hidden


_______________________________________________ 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>
References: 
 >Text character under the mouse cursor in an NSTextView (From: Dimitri Bouniol <email@hidden>)

  • Prev by Date: Re: NSCell subclass with custom binding
  • Next by Date: NSTextView's -setTextContainerInset: issues
  • Previous by thread: 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