VMACDDlg.cpp
上传用户:zhanglf88
上传日期:2013-11-19
资源大小:6036k
文件大小:3k
源码类别:

金融证券系统

开发平台:

Visual C++

  1. // VMACDDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "VMACDDlg.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CVMACDDlg dialog
  12. CVMACDDlg::CVMACDDlg(CWnd* pParent, CVMACD * pVMACD )
  13. {
  14. CParamDlg::CParamDlg(CVMACDDlg::IDD, pParent);
  15. //{{AFX_DATA_INIT(CVMACDDlg)
  16. m_nEMADays1 = 0;
  17. m_nEMADays2 = 0;
  18. m_nDIFDays = 0;
  19. //}}AFX_DATA_INIT
  20. m_pVMACD = pVMACD;
  21. }
  22. void CVMACDDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CParamDlg::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CVMACDDlg)
  26. DDX_Control(pDX, IDC_DEADFORK, m_cmbDeadFork);
  27. DDX_Control(pDX, IDC_GOLDENFORK, m_cmbGoldenFork);
  28. DDX_Control(pDX, IDC_DEVIATEONTOP, m_cmbDeviateOnTop);
  29. DDX_Control(pDX, IDC_DEVIATEONBOTTOM, m_cmbDeviateOnBottom);
  30. DDX_Control(pDX, IDC_STATIC_NAME, m_staticName);
  31. DDX_Text(pDX, IDC_EMADAYS1, m_nEMADays1);
  32. DDX_Text(pDX, IDC_EMADAYS2, m_nEMADays2);
  33. DDX_Text(pDX, IDC_DIFDAYS, m_nDIFDays);
  34. //}}AFX_DATA_MAP
  35. }
  36. BEGIN_MESSAGE_MAP(CVMACDDlg, CParamDlg)
  37. //{{AFX_MSG_MAP(CVMACDDlg)
  38. ON_BN_CLICKED(IDC_DEFAULT, OnDefault)
  39. ON_BN_CLICKED(IDC_PARAMHELP, OnHelp)
  40. //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CVMACDDlg message handlers
  44. BOOL CVMACDDlg::OnInitDialog() 
  45. {
  46. CParamDlg::OnInitDialog();
  47. ASSERT( m_pVMACD );
  48. // TODO: Add extra initialization here
  49. RefreshData( FALSE );
  50. return TRUE;  // return TRUE unless you set the focus to a control
  51.               // EXCEPTION: OCX Property Pages should return FALSE
  52. }
  53. void CVMACDDlg::OnCancel() 
  54. {
  55. }
  56. void CVMACDDlg::OnOK() 
  57. {
  58. // TODO: Add extra validation here
  59. if( !RefreshData( TRUE ) )
  60. m_pVMACD->SetDefaultParameters( );
  61. CParamDlg::OnOK();
  62. }
  63. void CVMACDDlg::OnDefault() 
  64. {
  65. // TODO: Add your control notification handler code here
  66. m_pVMACD->SetDefaultParameters( );
  67. RefreshData( FALSE );
  68. }
  69. void CVMACDDlg::OnHelp() 
  70. {
  71. ParamHelp( STT_VMACD );
  72. }
  73. BOOL CVMACDDlg::RefreshData( BOOL bSaveAndValidate )
  74. {
  75. if( !m_pVMACD->IsValidParameters() )
  76. m_pVMACD->SetDefaultParameters();
  77. if( bSaveAndValidate )
  78. {
  79. UpdateData( TRUE );
  80. m_pVMACD->m_nEMA1Days = m_nEMADays1;
  81. m_pVMACD->m_nEMA2Days = m_nEMADays2;
  82. m_pVMACD->m_nDIFDays = m_nDIFDays;
  83. m_pVMACD->m_itsDeviateOnBottom = m_cmbDeviateOnBottom.GetSelect();
  84. m_pVMACD->m_itsDeviateOnTop = m_cmbDeviateOnTop.GetSelect();
  85. m_pVMACD->m_itsGoldenFork = m_cmbGoldenFork.GetSelect();
  86. m_pVMACD->m_itsDeadFork = m_cmbDeadFork.GetSelect();
  87. return m_pVMACD->IsValidParameters();
  88. }
  89. else
  90. {
  91. m_staticName.SetWindowText( AfxGetSTTFullName(STT_VMACD) );
  92. m_nEMADays1 = m_pVMACD->m_nEMA1Days;
  93. m_nEMADays2 = m_pVMACD->m_nEMA2Days;
  94. m_nDIFDays = m_pVMACD->m_nDIFDays;
  95. m_cmbDeviateOnBottom.ResetAndSelect( m_pVMACD->m_itsDeviateOnBottom );
  96. m_cmbDeviateOnTop.ResetAndSelect( m_pVMACD->m_itsDeviateOnTop );
  97. m_cmbGoldenFork.ResetAndSelect( m_pVMACD->m_itsGoldenFork );
  98. m_cmbDeadFork.ResetAndSelect( m_pVMACD->m_itsDeadFork );
  99. UpdateData( FALSE );
  100. }
  101. return TRUE;
  102. }