关于DoDataExchange无法进行控件数据更新的问题

 

 1 CInputAngle::CInputAngle(CWnd* pParent /*=NULL*/)

 2 : CDialog(CInputAngle::IDD, pParent)

 3 , m_Edegree(3)

 4 , m_Eminute(4)

 5 , m_Esecond(4)

 6 , m_Adegree(35)

 7 , m_Aminute(3)

 8 , m_Asecond(5)

 9 {

10     m_pshdwdtct = new CShadDtect;

11 }

12 

13 void CInputAngle::DoDataExchange(CDataExchange* pDX)

14 {

15     CDialog::DoDataExchange(pDX);

16     DDX_Text(pDX, IDC_EDIT_Edegree, m_Edegree);

17     DDV_MinMaxInt(pDX, m_Edegree, 0, 360);

18     DDX_Text(pDX, IDC_EDIT_Eminute, m_Eminute);

19     DDV_MinMaxInt(pDX, m_Eminute, 0, 60);

20     DDX_Text(pDX, IDC_EDIT_Esecond, m_Esecond);

21     DDV_MinMaxInt(pDX, m_Esecond, 0, 60);    

22     DDX_Text(pDX, IDC_EDIT_Adegree, m_Adegree);

23     DDV_MinMaxInt(pDX, m_Adegree, 0, 360);

24     DDX_Text(pDX, IDC_EDIT_Aminute, m_Aminute);

25     DDV_MinMaxInt(pDX, m_Aminute, 0, 60);

26     DDX_Text(pDX, IDC_EDIT_Asecond, m_Asecond);

27     DDV_MinMaxInt(pDX, m_Asecond, 0, 60);

28 }

仅仅给各个控件赋初始值无法将用户自定义的新值传递过来。需要在用户赋值后调用的函数前添加

1 UpdateData(TRUE);

即将控件的值传递给参数。

 

你可能感兴趣的:(Exchange)