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