// ZoneDel.cpp : implementation file // #include "stdafx.h" #include "ocrutil.h" #include "ZoneDel.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CZoneRemove dialog CZoneRemove::CZoneRemove(L_INT nCount, CWnd* pParent /*=NULL*/) : CDialog(CZoneRemove::IDD, pParent) { //{{AFX_DATA_INIT(CZoneRemove) 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(); } 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::CheckOKButton() { CString csIndex; m_edtZoneIndex.GetWindowText(csIndex); L_BOOL bOK = FALSE; if (!csIndex.IsEmpty()) { L_INT nIndex = _ttoi(csIndex); bOK = (nIndex <= m_nZoneCount && nIndex >= 1); } L_BOOL bRemoveAll = IsDlgButtonChecked(IDC_CHK_REMOVE_ALL_ZONE); bOK = (bRemoveAll) ? bRemoveAll : bOK; m_btnOK.EnableWindow(bOK); } void CZoneRemove::OnOK() { CString csIndex; m_edtZoneIndex.GetWindowText(csIndex); if (csIndex.IsEmpty()) m_edtZoneIndex.SetWindowText(TEXT("0")); CDialog::OnOK(); }