]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/event.h
Relax wxMessageDialog style checks, assume wxOK by default.
[wxWidgets.git] / interface / wx / event.h
index d02d5a0d377fd0d2e61b09fa32972b949ee85b06..73f66d5fe98e5a871cddbdbcf1a553e1264532ac 100644 (file)
@@ -1393,11 +1393,11 @@ public:
         codes.
 
         Note that this method returns a meaningful value only for special
-        non-alphanumeric keys or if the user entered a character that can be
-        represented in current locale's default charset. Otherwise, e.g. if the
-        user enters a Japanese character in a program not using Japanese
-        locale, this method returns @c WXK_NONE and GetUnicodeKey() should be
-        used to obtain the corresponding Unicode character.
+        non-alphanumeric keys or if the user entered a Latin-1 character (this
+        includes ASCII and the accented letters found in Western European
+        languages but not letters of other alphabets such as e.g. Cyrillic).
+        Otherwise it simply method returns @c WXK_NONE and GetUnicodeKey()
+        should be used to obtain the corresponding Unicode character.
 
         Using GetUnicodeKey() is in general the right thing to do if you are
         interested in the characters typed by the user, GetKeyCode() should be
@@ -1406,12 +1406,23 @@ public:
         @code
             void MyHandler::OnChar(wxKeyEvent& event)
             {
-                if ( event.GetUnicodeKey() != WXK_NONE )
+                wxChar uc = event.GetUnicodeKey();
+                if ( uc != WXK_NONE )
                 {
-                    // It's a printable character
-                    wxLogMessage("You pressed '%c'", event.GetUnicodeKey());
+                    // It's a "normal" character. Notice that this includes
+                    // control characters in 1..31 range, e.g. WXK_RETURN or
+                    // WXK_BACK, so check for them explicitly.
+                    if ( uc >= 32 )
+                    {
+                        wxLogMessage("You pressed '%c'", uc);
+                    }
+                    else
+                    {
+                        // It's a control character
+                        ...
+                    }
                 }
-                else
+                else // No Unicode equivalent.
                 {
                     // It's a special key, deal with all the known ones:
                     switch ( GetKeyCode() )