wxFILTER_NUMERIC input vales < 0

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1192 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mart Raudsepp 1998-12-14 12:24:28 +00:00
parent 7b218dfaf4
commit 5885ba76c9

View File

@ -294,7 +294,7 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
wxBell(); wxBell();
return; return;
} }
if ( (m_validatorStyle & wxFILTER_NUMERIC) && !isdigit(keyCode) && keyCode != '.' ) if ( (m_validatorStyle & wxFILTER_NUMERIC) && !isdigit(keyCode) && keyCode != '.' && keyCode != '-')
{ {
wxBell(); wxBell();
return; return;
@ -309,6 +309,7 @@ static bool wxIsNumeric(const wxString& val)
for ( i = 0; i < (int)val.Length(); i++) for ( i = 0; i < (int)val.Length(); i++)
{ {
if ((!isdigit(val[i])) && (val[i] != '.')) if ((!isdigit(val[i])) && (val[i] != '.'))
if(!(i == 0) && (val[i] == '-'))
return FALSE; return FALSE;
} }
return TRUE; return TRUE;