Le 19 juin 08 à 10:32, Fred Leboucher a écrit :

Hi,

I'm trying to do something that was discussed before in the Carbon lists : convert a HID keyboard usage to a unicode character, with the current modifier
keys applied, and using the system-wide selected keyboard layout.

This technical note from Apple
(http://developer.apple.com/technotes/tn2002/tn2056.html) details the file formats available for keyboard layouts, but there's no information about the way
to:
- get info about the currently selected one
- a method to convert a key code to a unicode char (parsing the whole XML file and doing the conversion by hand would be quite nasty, assuming that you even
know how to do the first step: know what layout is to be used)

Anyone knows how to do that ?

Thanks for your help
Fred

Use UCKeyTranslate().

http://developer.apple.com/documentation/Carbon/Conceptual/Supporting_Unicode_Input/sui_tasks/chapter_3_section_4.html

Note that before Leopard, some keyboard layouts (French for example) does not have uchr ressources and uses the deprecated KCHR format instead. On Leopard, only some third party keyboard layouts use KCHR. In thoses cases, you will not able to use UCKeyTranslate(), but need to fallback to KeyTranslate() instead.

To retreive the current keyboard layout:
- The new way (Leopard), Text Input Source Services ( http://developer.apple.com/documentation/TextFonts/Reference/TextInputSourcesReference/Reference/reference.html ). - The old way, Keyboard layout services ( http://developer.apple.com/documentation/Carbon/Reference/KeyboardLayoutServices/Reference/reference.html ).


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to