remove debugging printf() from wxGridCellFloatEditor::IsAcceptedKey(); cleaned up the code a bit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-07-26 13:00:49 +00:00
parent 0f7a4d1fb5
commit 7b34da9bd6

View File

@@ -1192,27 +1192,30 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
{ {
if ( wxGridCellEditor::IsAcceptedKey(event) ) if ( wxGridCellEditor::IsAcceptedKey(event) )
{ {
int keycode = event.GetKeyCode(); const int keycode = event.GetKeyCode();
printf("%d\n", keycode); if ( isascii(keycode) )
// accept digits, 'e' as in '1e+6', also '-', '+', and '.' {
char tmpbuf[2]; char tmpbuf[2];
tmpbuf[0] = (char) keycode; tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0'; tmpbuf[1] = '\0';
wxString strbuf(tmpbuf, *wxConvCurrent); wxString strbuf(tmpbuf, *wxConvCurrent);
#if wxUSE_INTL #if wxUSE_INTL
bool is_decimal_point = const wxString decimalPoint =
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);
wxLOCALE_CAT_NUMBER) );
#else #else
bool is_decimal_point = ( strbuf == _T(".") ); const wxString decimalPoint(_T('.'));
#endif #endif
if ( (keycode < 128) && // accept digits, 'e' as in '1e+6', also '-', '+', and '.'
(wxIsdigit(keycode) || tolower(keycode) == 'e' || if ( wxIsdigit(keycode) ||
is_decimal_point || keycode == '+' || keycode == '-') ) tolower(keycode) == 'e' ||
{ keycode == decimalPoint ||
return true; keycode == '+' ||
keycode == '-' )
{
return true;
}
} }
} }