home *** CD-ROM | disk | FTP | other *** search
- // mydlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "chkbox.h"
- #include "mydlg.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyDlg dialog
-
-
- CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CMyDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CMyDlg)
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- m_CheckBoxStatus = 1;
- m_EditBoxContents = "I was updated inside CMyDlg()";
-
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- //}}AFX_DATA_INIT
- }
-
- void CMyDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyDlg)
- DDX_Check(pDX, IDC_MY_CHECK_BOX, m_CheckBoxStatus);
- DDX_Text(pDX, IDC_MY_EDIT_BOX, m_EditBoxContents);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
- //{{AFX_MSG_MAP(CMyDlg)
- ON_BN_CLICKED(IDC_MY_CHECK_BOX, OnMyCheckBox)
- ON_BN_CLICKED(IDC_DISABLE, OnDisable)
- ON_BN_CLICKED(IDC_ENABLE, OnEnable)
- ON_BN_CLICKED(IDC_HIDE, OnHide)
- ON_BN_CLICKED(IDC_SHOW, OnShow)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMyDlg message handlers
-
-
- void CMyDlg::OnMyCheckBox()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Update the variables, based on the contents of the
- // controls.
- UpdateData ( TRUE );
-
-
- // Based on the value of the check box variable,
- // update the variable of the edit box.
- if ( m_CheckBoxStatus == 1 )
- m_EditBoxContents = "My Check Box is checked.";
-
-
- if ( m_CheckBoxStatus == 0 )
- m_EditBoxContents = "My Check Box is not checked.";
-
- // Update the contents of the controls based on the values
- // of the variables,
- UpdateData ( FALSE );
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- }
-
- void CMyDlg::OnDisable()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- GetDlgItem(IDC_MY_CHECK_BOX)->EnableWindow(FALSE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMyDlg::OnEnable()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- GetDlgItem(IDC_MY_CHECK_BOX)->EnableWindow(TRUE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- }
-
- void CMyDlg::OnHide()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- GetDlgItem(IDC_MY_CHECK_BOX)->ShowWindow(SW_HIDE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMyDlg::OnShow()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- GetDlgItem(IDC_MY_CHECK_BOX)->ShowWindow(SW_SHOW);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- }
-
-