Unicode fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2004-02-10 22:16:55 +00:00
parent 3a818b15a1
commit 3fe7375573
2 changed files with 27 additions and 10 deletions

View File

@@ -1068,8 +1068,13 @@ void wxGridCellFloatEditor::Reset()
void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
{
int keycode = event.GetKeyCode();
char tmpbuf[2];
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
bool is_decimal_point = ( wxString(tmpbuf, *wxConvCurrent) ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| keycode == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER)[0u]
|| is_decimal_point
|| keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1
|| keycode == WXK_NUMPAD2
@@ -1168,13 +1173,21 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
case WXK_NUMPAD_DECIMAL:
return TRUE;
default:
// additionally accept 'e' as in '1e+6', also '-', '+', and '.'
default:
{
// additionally accept 'e' as in '1e+6', also '-', '+', and '.'
char tmpbuf[2];
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
bool is_decimal_point =
( wxString(tmpbuf, *wxConvCurrent) ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
wxLOCALE_CAT_NUMBER) );
if ( (keycode < 128) &&
(wxIsdigit(keycode) || tolower(keycode) == 'e' ||
keycode == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER)[0u] ||
keycode == '+' || keycode == '-') )
is_decimal_point || keycode == '+' || keycode == '-') )
return TRUE;
}
}
}