Get ASCII Char from Keystroke and modifier?

Aya Koshigaya Aya at animes.de
Tue Apr 15 03:18:09 PDT 2008


Hi,

> Also note that both the cocoa and carbon events allow you to get  
> either the raw characters and the interpreted characters. For Cocoa  
> look into NSEvent, and for Carbon read the Carbon Event Manager  
> Programming Guide.

yes, but I've used glut to create my OpenGL window.. so all I get from  
the glut lib is the key that was pressed (i.E. "n") and the modifier..

Aya



On Apr 15, 2008, at 12:11, Christiaan Hofman wrote:
>
> On 15 Apr 2008, at 11:51 AM, Bill Cheeseman wrote:
>
>> on 2008-04-14 6:32 PM, Aya Koshigaya at Aya at animes.de wrote:
>>
>>> I'm writing a glut-application and need to know what key the user  
>>> has
>>> pressed.
>>
>> If you're looking for the character (as opposed to the key), one  
>> possibility
>> is to use the UCKeyTranslate() function, in Unicode Utilities. It  
>> returns
>> the string of Unicode characters generated by a given key  
>> combination, given
>> the hardware-independent keycode, the keyboard type, and other  
>> information.
>> See the "Unicode Utilities Reference" document for details.
>>
>> Depending on what you're doing, there may be an easier way to get the
>> character from the key down or key up event.
>>
>> --
>>
>> Bill Cheeseman - bill at cheeseman.name
>> Quechee Software, Quechee, Vermont, USA
>> www.quecheesoftware.com
>>
>> PreFab Software - www.prefabsoftware.com
>>
>
> Also note that both the cocoa and carbon events allow you to get  
> either the raw characters and the interpreted characters. For Cocoa  
> look into NSEvent, and for Carbon read the Carbon Event Manager  
> Programming Guide.
>
> Christiaan
>



More information about the MacOSX-dev mailing list