in my dialog, there is a CEdit box, which set maximum character number. below in DoDataExchange function:
void CDlgSurvey::DoDataExchange(CDataExchange* pDX)
{
DDX_Control(pDX, IDC_EDIT_SURVEY_ID, m_SurveyIDEdit);//ACUTALLY THE ISSUE IS HERE,SO LATER WE MODIFIED THE CLASS FUNCTION Onchar in m_SurveyIDEdit RELATED
DDX_Text(pDX, IDC_EDIT_SURVEY_ID, m_SurveyID);
DDV_MaxChars(pDX, m_SurveyID, SURVEY_ID_FIELD_LENGTH);
}
I found it works. it means I cannot key in characters more than SURVEY_ID_FIELD_LENGTH. But the problem is when I already key in the SURVEY_ID_FIELD_LENGTH length of characters, and I tried to delete some character by using backspace at the end of text. it doesn't work. Did somebody met such problem? and I also try to using another way to set max text in OnInitDialog,
BOOL CDlgSurvey::OnInitDialog()
{
//set Max Text in Edit Box
CEdit* pEditControl = (CEdit*)GetDlgItem(IDC_EDIT_SURVEY_ID);
if (pEditControl)
{
pEditControl->SetLimitText(SURVEY_ID_FIELD_LENGTH);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
the problem is the same, again, I cannot use backspace after it reached the maximum character. Does someone have any idea on how to fix it? thanks,