|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Rado Manzela
|
Feb 28, 2011 - 6:25 AM
|
It seems you don’t have time to fix bug I’ve reported so I did it by myself, you could check it (btw the same problem with decimal separator is also in CExtEditSystemNumber):
long double CExtEditSystemCurrency::LongDoubleGet() const{ //return CExtEditSystemCurrency::LongDoubleGet();ASSERT_VALID( CExtSafeString str = _GetNumericText( m_pEditWithBehaviorWnd->TextGet(), str.Replace(m_strCurrencySymbol,_T( this );false );"")); //rrrstr.Trim(); //rrr if( str.IsEmpty()//rrr || str == _T(".") || str == LPCTSTR(m_strDecimalPoint) || ( str.GetLength() == 1 && m_strDecimalPoint.GetLength() > 0 && str[0] == m_strDecimalPoint[0] ) ) LCID _LCID = LANG_USER_DEFAULT; _LCID = g_ResourceManager->GetLangIdDesired(); COleCurrency _oleCurrency; VERIFY( _oleCurrency.ParseCurrency( LPCTSTR(str), 0, _LCID ) ); } return 0.0;if( g_ResourceManager->IsCustomLangAllowed() )long double lfVal = ((long double)_oleCurrency.m_cur.int64) / ((long double)10000.0);return lfVal;
|
|
Technical Support
|
Mar 4, 2011 - 10:31 AM
|
We need to know exactly which Decima symbol and Digit grouping symbol are specified in the locale settings on your computer? They should be be equal to each other.
|
|
Rado Manzela
|
Mar 4, 2011 - 1:35 PM
|
|
|
Technical Support
|
Mar 3, 2011 - 7:59 AM
|
We are sorry but we re-checked the CExtEditSystemCurrency editor control using the <span class="newgreen">ProfUIS_Controls</code> sample application and it works. Please provide more details about why you decided to fix it?
|
|
Rado Manzela
|
Mar 3, 2011 - 2:11 PM
|
I’ve tried ProfUIS_Controls now. When I set windows language format to "Slovak", currency edit shows "0 $". I click behind the "0", I press comma, then 4 for example and it asserts. I don’t know why sample is not calling CExtEditSystemCurrency::LongDoubleGet() which I’ve modified. It calls CExtEditSystemNumber::LongDoubleGetBase() which is also buggy. It converts string using _GetNumericText() which changes comma to dot, then it is parsing string with dot as decimal separator using user’s locale (set to Slovak, which is using COMMA as separator), that’s why it fails. For currency parsing I’ve added removal of currency symbol to allow using of CExtEditSystemCurrency with different currency symbol, than current system’s currency. In CExtEditSystemCurrency::LongDoubleGet() you are comparing string with str == _T(".") although the string is in user’s locale format which can use different decimal separator ("." can be thousands separator for example)
|
|
Rado Manzela
|
Feb 28, 2011 - 6:29 AM
|
I’m sorry but your editor have messed up the code. 2nd try:
long double CExtEditSystemCurrency::LongDoubleGet() const { //return CExtEditSystemCurrency::LongDoubleGet();
ASSERT_VALID( this ); CExtSafeString str = _GetNumericText( m_pEditWithBehaviorWnd->TextGet(), false ); str.Replace(m_strCurrencySymbol,_T("")); //rrr str.Trim(); //rrr if( str.IsEmpty() //rrr || str == _T(".") || str == LPCTSTR(m_strDecimalPoint) || ( str.GetLength() == 1 && m_strDecimalPoint.GetLength() > 0 && str[0] == m_strDecimalPoint[0] ) ) return 0.0;
LCID _LCID = LANG_USER_DEFAULT; if( g_ResourceManager->IsCustomLangAllowed() ) _LCID = g_ResourceManager->GetLangIdDesired(); COleCurrency _oleCurrency; VERIFY( _oleCurrency.ParseCurrency( LPCTSTR(str), 0, _LCID ) ); long double lfVal = ((long double)_oleCurrency.m_cur.int64) / ((long double)10000.0); return lfVal; }
|
|