void CArborEdit::DDV_Float() { // check to see if the control was modified at all....if so continue if( GetModify() ) { double dMinVal = 0.0; double dMaxVal = 0.0; // if they didn't set a range, but entered a number, validate with max values // that can be stored in the database..... if( m_bDoubleRangeSet ) { dMinVal = m_dMinValue; dMaxVal = m_dMaxValue; } else { if( m_bNegativeValue ) dMinVal = INT_MIN/100.0; else dMinVal = 0.0; dMaxVal = INT_MAX/100.0; } if( !ValidateDouble( dMinVal, dMaxVal ) ) { CGuiMsg::GuiMessage(GUIMSG_NUMBER_DOUBLE_RANGE_INVALID, dMinVal, dMaxVal ); SetSel( 0, -1 ); SetFocus(); AfxThrowUserException(); } } }
double GetInputDouble(ifstream& file) { string temp = ""; double number = 0; //get the line from the text file. (Just like with cin) getline(file, temp); //test if the file is at the end if (file.eof()) { throw IOException(ERROR_EOF, DEFAULT); return 0.0; } //test if input is bad, or failed else if (file.bad() || file.fail()) { throw IOException(ERROR_FILE_FAIL, DEFAULT); } number = ValidateDouble(temp); return number; } // End GetValidInputDouble()
void CArborEditCurrency::DDV_Float() { // check to see if the control was modified at all....if so continue if( GetModify() ) { double dMinVal = 0.0; double dMaxVal = 0.0; // if they didn't set a range, but entered a number, validate with max values // that can be stored in the database..... if( m_bDoubleRangeSet ) { dMinVal = m_dMinValue; dMaxVal = m_dMaxValue; } else { if( m_bNegativeValue ) dMinVal = INT_MIN/100.0; else dMinVal = 0.0; dMaxVal = INT_MAX/100.0; } if( !ValidateDouble( dMinVal, dMaxVal ) ) { CString sMsg; // sMsg.Format( "Number is not valid!\nPlease enter a number between %f - %f.", dMinVal, dMaxVal ); sMsg.Format( GetIntlString(IDS_NUMBER_NOT_VALID_MSG),"%f - %f.", dMinVal, dMaxVal ); AfxMessageBox( sMsg, MB_ICONEXCLAMATION ); SetSel( 0, -1 ); SetFocus(); AfxThrowUserException(); } } }