|
-
June 25th, 1999, 01:49 AM
#1
formated number in CEdit
Hi,
I have a dialog that contains CEdit boxes. They are attached to a member, as m_fValue. When m_fValue is close to 0, but not exactly 0 as 5.675799877e-10, I see only 5.6757 in the CEdit ! So the user get a wrong information.
I can replace m_fValue by m_sValue and use m_sValue.Format("%5.3f",&m_fValue), but this is not elegant and I have to take care about the relevant format for each CEdit box.
Is there an elegant way ?
-
June 25th, 1999, 02:47 AM
#2
Re: formated number in CEdit
I am not sure, but I think you variable is float. Make it double and everything will be ok.
-
June 25th, 1999, 04:54 AM
#3
Re: formated number in CEdit
This is not a problem with float or double. This is only with display: my CEdit box is to small to display all characters, so the user don't the last characters so he gets the impression that the number is far form 0 !!!!
Is there any possibility to force an appropriate display for numbers close to 0
-
June 25th, 1999, 09:53 AM
#4
Re: formated number in CEdit
I am not sure whether this will help, but you can force a display by typing
SetDlgItemText(IDC_EDITxx, "0.0");
and you could setup something like
if (m_fvalue < .00001) SetDlgItemText(....)
I hope this helps.
-
June 28th, 1999, 04:43 AM
#5
Re: formated number in CEdit
This helps, but if I have to check values, I will prefer to write something like:
1) add a member m_sValue to the CEdit
2) when m_fValue is updated,
m_sValue.Format("%7.3f",m_fValue);
UpdateData(FALSE);
And this is what I don't want to do, but it works...
Yves Le Sant
Metrology and Measurement Unit
Fundamental and Experimental Aerodynamics Departement
ONERA Meudon
(Office National d'Etudes et de Recherches Aérospatiales)
FRANCE
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|