1

I am developping an input method on Mac OS. Now I have a problem. I need to switch the input mode to english if the current input text field is for password. But I do not know how to do the check. How can I know the current input field is a password field?

gang
  • 31
  • 2

3 Answers3

2

As squeeks mentioned, you need not to do anything because NSSecureTextFieldCells are supposed to allow merely Roman keyboards. However, Mac OS X 10.6 has a bug, If your Input Method's Info.plist file does not contain the TISIntendedLanguage setting, the secure text fields are not able to tell your Input Method is not a Roman input source.

What you need to do is to add the following lines to your Info.plist file. I take Traditional Chinese for example, please change 'zh-Hant' to your language setting.

<key>TISIntendedLanguage</key>
<string>zh-Hant</string>
zonble
  • 4,213
  • 1
  • 21
  • 14
0

Append below content to a Input Method App's Info.plist, then the Input Method can be used in password textfield:

<key>tsInputMethodCharacterRepertoireKey</key>
<array>
  <string>Latn</string>
</array>
DongYuwei
  • 21
  • 4
0

NSSecureTextFieldCells handle text input differently than regular text fields, and by default is set only to allow Roman characters. When a user brings this field into focus, IMEs and other formats should be disabled from the keyboard entry selection so this shouldn't be an issue.

squeeks
  • 1,269
  • 11
  • 14
  • Thank you. But the problem is the text field is allowed to input characters not only Roman, for example,the loginwindow of MacOS. I want to know some methods to check whether the current edit field is for password. – gang Jul 04 '11 at 11:04