Use wxKeyEvent::GetUnicodeKey() correctly, there is no need to guess about
what does it return now that its correct behaviour is documented and
implemented. Simply check if it returns WXK_NONE to check for non-characters.
Also use WXK_START instead of hard-coded 255 when checking GetKeyCode()
result.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65748
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
{
bool ctrl = event.ControlDown();
bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
{
bool ctrl = event.ControlDown();
- bool alt = event.AltDown();
#ifdef __WXMAC__
// On the Mac the Alt key is more like shift and is used for entry of
// valid characters, so check for Ctrl and Meta instead.
alt = event.MetaDown();
#ifdef __WXMAC__
// On the Mac the Alt key is more like shift and is used for entry of
// valid characters, so check for Ctrl and Meta instead.
alt = event.MetaDown();
+#else // !__WXMAC__
+ alt = event.AltDown();
+#endif // __WXMAC__/!__WXMAC__
// Assume it's not a valid char if ctrl or alt is down, but if both are
// down then it may be because of an AltGr key combination, so let them
// Assume it's not a valid char if ctrl or alt is down, but if both are
// down then it may be because of an AltGr key combination, so let them
return false;
#if wxUSE_UNICODE
return false;
#if wxUSE_UNICODE
- // if the unicode key code is not really a unicode character (it may
- // be a function key or etc., the platforms appear to always give us a
- // small value in this case) then fallback to the ASCII key code but
- // don't do anything for function keys or etc.
- if ( event.GetUnicodeKey() > 127 && event.GetKeyCode() > 127 )
+ if ( event.GetUnicodeKey() == WXK_NONE )
- if ( event.GetKeyCode() > 255 )
+ if ( event.GetKeyCode() > WXK_START )
bool wxGridCellTextEditor::IsAcceptedKey(wxKeyEvent& event)
{
bool wxGridCellTextEditor::IsAcceptedKey(wxKeyEvent& event)
{
- return wxGridCellEditor::IsAcceptedKey(event);
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_DELETE:
+ case WXK_BACK:
+ return true;
+
+ default:
+ return wxGridCellEditor::IsAcceptedKey(event);
+ }
}
void wxGridCellTextEditor::StartingKey(wxKeyEvent& event)
}
void wxGridCellTextEditor::StartingKey(wxKeyEvent& event)
#if wxUSE_UNICODE
ch = event.GetUnicodeKey();
#if wxUSE_UNICODE
ch = event.GetUnicodeKey();
+ if ( ch != WXK_NONE )
+ isPrintable = true;
+ else
+#endif // wxUSE_UNICODE
+ {
ch = (wxChar)event.GetKeyCode();
ch = (wxChar)event.GetKeyCode();
-#else
- ch = (wxChar)event.GetKeyCode();
-#endif
+ isPrintable = ch >= WXK_SPACE && ch < WXK_START;
+ }
+ if ( isPrintable )
+ tc->WriteText(ch);