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: 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