+
+ wxString chars;
+ if ( eventType != NSFlagsChanged )
+ {
+ NSString* nschars = [nsEvent characters];
+ if ( nschars )
+ {
+ wxCFStringRef cfchars((CFStringRef)[nschars retain]);
+ chars = cfchars.AsString();
+ }
+ }
+
+ int unichar = chars.Length() > 0 ? chars[0] : 0;
+ long keyval = wxOSXTranslateCocoaKey(unichar) ;
+ if ( keyval == unichar && ( wxevent.GetEventType() == wxEVT_KEY_UP || wxevent.GetEventType() == wxEVT_KEY_DOWN ) )
+ keyval = wxToupper( keyval ) ;
+
+#if wxUSE_UNICODE
+ wxevent.m_uniChar = unichar;
+#endif
+ wxevent.m_keyCode = keyval;