Re: Text character under the mouse cursor in an NSTextView
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