开发者

How can a Cocoa app support bottomline text input?

开发者 https://www.devze.com 2022-12-18 02:24 出处:网络
I\'m attempting to support international input in a Cocoa app on Leopard using bottom line input (A type of input method in which the user enters text in a small window, called a floating input w开发者

I'm attempting to support international input in a Cocoa app on Leopard using bottom line input (A type of input method in which the user enters text in a small window, called a floating input w开发者_运维百科indow, that appears near the bottom of the screen).

I don't want to support inline input.

When the user changes the input method using the input menu, I don't see the standard floating input window when the user types text into my app. Anyone know what my app needs to do to get this input window?

Thanks.


As far as I understand (correct me if I'm wrong), there's no middle ground of just supporting the bottomline input window in Cocoa. The primary way to support the input method is to implement the NSTextInputClient protocol, which implements the inline editing. There's a nice sample code available how to implement it.

In the days of Carbon, your choices were the Carbon events

  • kEventTextInputUpdateActiveInputArea for the inline input, or
  • kEventTextInputUnicodeForKeyEvent for the bottomwindow input.

See Text Services Manager in Carbon. However these are not available in 64-bit Cocoa app. For 32-bit Cocoa app, you might be able to install the handler for the latter, using the dreaded Carbon-Cocoa integration. But this will surely be more complicated than implementing the NSTextInputClient protocol.

So, my suggestion is to implement the inline editing using NSTextInputClient. That will make many East Asians happy, including me.

0

精彩评论

暂无评论...
验证码 换一张
取 消