DDV functions
-
Hi Everybody, I have a class which is being derived from CDialog class. class CEventDialog : public CDialog { private: CString m_sEventDesc; int m_iHours; int m_iMin; // Other implementation has been removed from the class. }; The deifination for DoDataExchange is as follows: void CEventDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Text(pDX,IDC_ADDSTRHR,this->m_iHours); DDV_MinMaxInt(pDX,this->m_iHours,1,24); DDX_Text(pDX,IDC_EDITDESC,this->m_sEventDesc); DDV_MaxChars(pDX,this->m_sEventDesc,20); DDX_Text(pDX,IDC_ADDSTRMIN,this->m_iMin); DDV_MinMaxInt(pDX,this->m_iMin,1,59); } The problem which i am facing is that if i enter an invalid value for iMin data variable , the DDV_MinMaxInt function displays a message box without any message in it. How should i display the used defined message in the Message Nox which is being created by DDV_MinMaxInt function? Regards Dinesh
-
Hi Everybody, I have a class which is being derived from CDialog class. class CEventDialog : public CDialog { private: CString m_sEventDesc; int m_iHours; int m_iMin; // Other implementation has been removed from the class. }; The deifination for DoDataExchange is as follows: void CEventDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Text(pDX,IDC_ADDSTRHR,this->m_iHours); DDV_MinMaxInt(pDX,this->m_iHours,1,24); DDX_Text(pDX,IDC_EDITDESC,this->m_sEventDesc); DDV_MaxChars(pDX,this->m_sEventDesc,20); DDX_Text(pDX,IDC_ADDSTRMIN,this->m_iMin); DDV_MinMaxInt(pDX,this->m_iMin,1,59); } The problem which i am facing is that if i enter an invalid value for iMin data variable , the DDV_MinMaxInt function displays a message box without any message in it. How should i display the used defined message in the Message Nox which is being created by DDV_MinMaxInt function? Regards Dinesh
Have you stepped into
DDV_MinMaxInt()
to see why it is failing to retrieve the text?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Have you stepped into
DDV_MinMaxInt()
to see why it is failing to retrieve the text?
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
I did that : DDV_MinMaxInt internally calls _AfxFailMinMaxWithFormat function AFX_STATIC void AFXAPI _AfxFailMinMaxWithFormat(CDataExchange* pDX, long minVal, long maxVal, LPCTSTR lpszFormat, UINT nIDPrompt) { ASSERT(lpszFormat != NULL); if (!pDX->m_bSaveAndValidate) { TRACE0("Warning: initial dialog data is out of range.\n"); return; // don't stop now } TCHAR szMin[32]; TCHAR szMax[32]; wsprintf(szMin, lpszFormat, minVal); wsprintf(szMax, lpszFormat, maxVal); CString prompt; AfxFormatString2(prompt, nIDPrompt, szMin, szMax); AfxMessageBox(prompt, MB_ICONEXCLAMATION, nIDPrompt); prompt.Empty(); // exception prep pDX->Fail(); } The prompt variable comes out to be empty. Do I have to explicitly create a String Resource and pass that resource in one of these functions ? Regards Dinesh
-
I did that : DDV_MinMaxInt internally calls _AfxFailMinMaxWithFormat function AFX_STATIC void AFXAPI _AfxFailMinMaxWithFormat(CDataExchange* pDX, long minVal, long maxVal, LPCTSTR lpszFormat, UINT nIDPrompt) { ASSERT(lpszFormat != NULL); if (!pDX->m_bSaveAndValidate) { TRACE0("Warning: initial dialog data is out of range.\n"); return; // don't stop now } TCHAR szMin[32]; TCHAR szMax[32]; wsprintf(szMin, lpszFormat, minVal); wsprintf(szMax, lpszFormat, maxVal); CString prompt; AfxFormatString2(prompt, nIDPrompt, szMin, szMax); AfxMessageBox(prompt, MB_ICONEXCLAMATION, nIDPrompt); prompt.Empty(); // exception prep pDX->Fail(); } The prompt variable comes out to be empty. Do I have to explicitly create a String Resource and pass that resource in one of these functions ? Regards Dinesh
So what is the value of
CEventDialog::iMin
,minVal
, andmaxVal
at this point?
A rich person is not the one who has the most, but the one that needs the least.
-
So what is the value of
CEventDialog::iMin
,minVal
, andmaxVal
at this point?
A rich person is not the one who has the most, but the one that needs the least.
Hello, You can try the following in the OnInitDialog: CEdit* pEditControl = (CEdit*)GetDlgItem(IDC_EDIT1); if(pEditControl) { pEditControl->SetLimitText(6) ; } Hope this works.. Regards, Maheshwar.