Click to See Complete Forum and Search --> : DoDataExchange
Amy
June 2nd, 1999, 09:59 AM
I want to validate the data in the DodataExchange() for two different cases. For example, for case 1, the values of x are in range 1 to 10 whereas for case two the values of x are in range from 10 to 1000. (where x is displayed in the Edit box)
Any hint???
Thanks in advance,
Amy
Safai Ma
June 2nd, 1999, 10:03 AM
I had a simliar problem a while back with validating the number of days in a given month. Here is the code that I used to validate it.
void CTimeWizardPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTimeWizardPage)
//}}AFX_DATA_MAP
if ((m_iMonth == 2) && !(m_iYear % 4)) {
DDV_MinMaxInt(pDX, m_iDay, 1, 29);
} else {
DDV_MinMaxInt(pDX, m_iDay, 1, iDayRange[m_iMonth]);
}
}
I put it after the class wizard stuff so that when I use class wizard, it won't mess up my 'customized' validation code.
-Safai
Amy
June 2nd, 1999, 10:48 AM
Thanks for the hint. I tried exactly as follows:
DDX_Text(pDX, IDC_SPEED, Speed);
//}}AFX_DATA_MAP
if (type == first)
DDV_MinMaxFloat(pDX, Speed, 1.0, 10.0);
else
DDV_MinMaxFloat(pDX, Speed, 10.0, 1000.0);
When I execute the app., it shows the message to select between 1 to 10 before starting the app.
Any idea why???
Thanks.
Amy
Safai Ma
June 2nd, 1999, 10:59 AM
"Speed" is properly not initialized before you call "CDialog::OnInitDialog()" or "CPropertyPage::OnInitDialog()". DDX and DDV routines are called by the framework's OnInitDialog().
-Safai
Amy
June 2nd, 1999, 11:53 AM
I have initalized the Speed in the constructor to be 10.
Amy
Safai Ma
June 2nd, 1999, 12:39 PM
I have no idea why it puts up that message. Try putting a breakpoint in your DoDataExchange function and step through it to see if Speed or Type is set right.
-Safai
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.