// ZoneRemove.cpp : implementation file // #include "stdafx.h" #include "msvc5ocr.h" #include "ZoneRemove.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CZoneRemove dialog CZoneRemove::CZoneRemove(int nCount, CWnd* pParent /*=NULL*/) : CDialog(CZoneRemove::IDD, pParent) { //{{AFX_DATA_INIT(CZoneRemove) // NOTE: the ClassWizard will add member initialization here m_bDelZones = FALSE; m_nZoneIndex = 1; //}}AFX_DATA_INIT m_nZoneCount = nCount; } void CZoneRemove::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CZoneRemove) DDX_Control(pDX, IDOK, m_btnOK); DDX_Control(pDX, IDC_EDIT_ZONE_INDEX, m_edtZoneIndex); DDX_Check(pDX, IDC_CHK_REMOVE_ALL_ZONE, m_bDelZones); DDX_Text(pDX, IDC_EDIT_ZONE_INDEX, m_nZoneIndex); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CZoneRemove, CDialog) //{{AFX_MSG_MAP(CZoneRemove) ON_BN_CLICKED(IDC_CHK_REMOVE_ALL_ZONE, OnChkRemoveAllZone) ON_EN_CHANGE(IDC_EDIT_ZONE_INDEX, OnChangeEditZoneIndex) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CZoneRemove message handlers void CZoneRemove::OnChkRemoveAllZone() { m_edtZoneIndex.EnableWindow(!IsDlgButtonChecked(IDC_CHK_REMOVE_ALL_ZONE)); CheckOKButton(); } void CZoneRemove::OnChangeEditZoneIndex() { CheckOKButton(); } void CZoneRemove::CheckOKButton() { CString csIndex; m_edtZoneIndex.GetWindowText(csIndex); BOOL bOK = FALSE; if (!csIndex.IsEmpty()) { int nIndex = _ttoi(csIndex); bOK = (nIndex <= m_nZoneCount && nIndex >= 1); } BOOL bRemoveAll = IsDlgButtonChecked(IDC_CHK_REMOVE_ALL_ZONE); bOK = (bRemoveAll) ? bRemoveAll : bOK; m_btnOK.EnableWindow(bOK); } BOOL CZoneRemove::OnInitDialog() { CDialog::OnInitDialog(); m_edtZoneIndex.SetWindowText(_TEXT("")); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CZoneRemove::OnOK() { CString csIndex; m_edtZoneIndex.GetWindowText(csIndex); if (csIndex.IsEmpty()) m_edtZoneIndex.SetWindowText(_TEXT("0")); CDialog::OnOK(); }