Re: Receiving Unicode Input in NSView
Re: Receiving Unicode Input in NSView
- Subject: Re: Receiving Unicode Input in NSView
- From: Bill Appleton <email@hidden>
- Date: Mon, 01 Aug 2011 09:13:46 -0700
Hi Aki and others,
So implementing the NSTextInputClient protocol works great in our
stand-alone product, we get unicode as expected
In the browser product we synthesize NSEvents for key downs and send them
through the same system with handleEvent
this does NOT work as expected, which i think is what Aki was trying to tell
me last week :)
so this is because there must be extra hidden contextual information in the
system not captured in the NSEvents for keyDowns
so we DO have to use the (buggy, new) NPAPI handlers to get unicode text
into the plugin
Please jump right in if i am missing something... hopefully this thread will
help future travelers
Best,
Bill
On Fri, Jul 29, 2011 at 11:22 AM, Aki Inoue <email@hidden> wrote:
> Bill,
>
> > we used to call interpretKeyEvents in the keyDown handler and the
> InsertText
> > handler would get the unicode string, I guess this stopped working with a
> > system update a while back.
> We have always required the first responder to adopt either NSTextInput or
> NSTextInputClient for handling text input with complex user interaction
> required such as the deadkey sequence.
>
> > 1) subclass nsview and make it conform to the NSTextInputClient protocol
> >
> > i have been picking away at this, i added the NSTextInputClient handlers
> but
> > they aren't being called. a working example or a pointer would help if
> > anyone has done this.
> Yes, we do have a sample. Check out
> file://localhost/Developer/Examples/AppKit/TextInputView/
>
> Aki
>
> On 2011/07/29, at 7:31, Bill Appleton wrote:
>
> > Hi all,
> >
> > I have seen this issue come up a lot, but there isn't much information on
> > how to receive unicode input in a NSView.
> >
> > (I know we are supposed to just type in a NSTextField but that is
> impossible
> > in our situation where the app must run stand-alone and as a browser
> > plugin).
> >
> > we used to call interpretKeyEvents in the keyDown handler and the
> InsertText
> > handler would get the unicode string, I guess this stopped working with a
> > system update a while back.
> >
> > Now i think there are 2 ways to do this:
> >
> > 1) subclass nsview and make it conform to the NSTextInputClient protocol
> >
> > i have been picking away at this, i added the NSTextInputClient handlers
> but
> > they aren't being called. a working example or a pointer would help if
> > anyone has done this.
> >
> > 2) use a fake NSTextField and try to use that for gathering the unicode
> as
> > it arrives.
> >
> > I have seen someone recommend NSWindow fieldEditor:forObject: to do this.
> > This sounds pretty bad and i have a lot of uncertainty as to how to make
> > this work right.
> >
> > So do you guys have a recommendation here?
> >
> > thanks in advance
> > _______________________________________________
> >
> > Cocoa-dev mailing list (email@hidden)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden