MFC EditControl value is not in private member

I have a dialog box with static text and editing. In the dialog box control class, I have a control variable that sets an initial value in the edit box and an int value that will be the value of the edit box when changed by the user. Both are private variable, but I am not getting the value in an integer variable. Is there any way to detect this below, this is a sample code base

class CYrdAuthorityPage : public CPropertyPage
{
    DECLARE_DYNAMIC(CYrdAuthorityPage)

public:
    CYrdAuthorityPage();
    virtual ~CYrdAuthorityPage();

// Dialog Data
    enum { IDD = IDD_YRD_AUTHORITY_DIALOG };


protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

    DECLARE_MESSAGE_MAP()
private:
    CEdit m_authctrl;
    int m_authval;
public:
    afx_msg void OnEnChangeAuthEdit();

};

IMPLEMENT_DYNAMIC(CYrdAuthorityPage, CPropertyPage)

CYrdAuthorityPage::CYrdAuthorityPage()
    : CPropertyPage(CYrdAuthorityPage::IDD)
{

}

CYrdAuthorityPage::~CYrdAuthorityPage()
{
}

void CYrdAuthorityPage::DoDataExchange(CDataExchange* pDX)
{
    CPropertyPage::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_AUTH_EDIT, m_authctrl);
    DDX_Text(pDX,IDC_AUTH_EDIT,m_authval);
}


/*BEGIN_MESSAGE_MAP(CYrdAuthorityPage, CPropertyPage)
    ON_EN_CHANGE(IDC_AUTH_EDIT, &CYrdAuthorityPage::OnEnChangeAuthEdit)
END_MESSAGE_MAP()*/

      

M_authval is irrelevant here. I think it might be because it's private but making it public gives the same result. I set the edit box to center align the text.

thank

+3


source to share


1 answer


The exchange of data between the control and an int variable does not magically happen. This happens when you call the UpdateData member function. Do you have any calls for this feature?



+1


source







All Articles