arindam042099
asked on
formating the variables in a dialog box
How do I make the values appearing in the dialog box for variables dlg.m_edit3 and dlg.m_edit4 show only upto 3 significant variables inside of more than 5-6 significant variables it is now showing (the code is shown below) ... What do I need to change in the code below ...
Thanks
// ******
void CRms_VoltageView::OnLButto nUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// Dialog Box No. 2
CdlgDialog2 dlg;
if (m_bDraw)
{
// ??????????? this is where the
// problem is ?????????????
dlg.m_edit3 = (float)pline_array[current _line].fin _volt;
dlg.m_edit4 = (float)pline_array[current _line].fin _time;
if (dlg.DoModal() == IDOK)
{
.....
}
Thanks
// ******
void CRms_VoltageView::OnLButto
{
// TODO: Add your message handler code here and/or call default
// Dialog Box No. 2
CdlgDialog2 dlg;
if (m_bDraw)
{
// ??????????? this is where the
// problem is ?????????????
dlg.m_edit3 = (float)pline_array[current
dlg.m_edit4 = (float)pline_array[current
if (dlg.DoModal() == IDOK)
{
.....
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may use the C Run-time Library functions _tcstod(strtod, wcstod) to convert strings to a double-precision value.
ASKER
can I use atof also .... what will be the difference between the two .. does atof convert CString member variables
THANKS
THANKS
ASKER
why is it I cannot format a float member variables to show 3 significant digits when my dialog box pops up ... and is so what is the code to do that ..
thanks
thanks
atof does it as well. The only difference is that strtod returns a pointer to character that stops scan.
I don't understand your last comment.
I don't understand your last comment.
ASKER
What I meant was why convert to string and then convert from string to float .. why cannot I use float all the way and only use formating to display into the dialog box ...
Because an edit control accepts strings only and there is no function to format a float number into an edit control.
ASKER
thanks
ASKER
Once the values that are in pline_array[current_line].
m_Setvolt = dlg.m_edit3;
m_Tracetime =(float) ((int)((dlg.m_edit4/Half_P