// SelectPage.cpp : implementation file // #include "stdafx.h" #include "msvc5ocr.h" #include "SelectPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSelectPage dialog CSelectPage::CSelectPage(int nDlgType, int nPageCount, CWnd* pParent /*=NULL*/) : CDialog(CSelectPage::IDD, pParent) { //{{AFX_DATA_INIT(CSelectPage) // NOTE: the ClassWizard will add member initialization here m_nPageNum = 1; //}}AFX_DATA_INIT m_nPageCount = nPageCount; m_nDlgType = nDlgType; } void CSelectPage::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSelectPage) // NOTE: the ClassWizard will add DDX and DDV calls here DDX_Control(pDX, IDC_EDIT_PAGE_NUMBER, m_edtPageNum); DDX_Control(pDX, IDOK, m_btnOK); DDX_Text(pDX, IDC_EDIT_PAGE_NUMBER, m_nPageNum); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CSelectPage, CDialog) //{{AFX_MSG_MAP(CSelectPage) ON_EN_CHANGE(IDC_EDIT_PAGE_NUMBER, OnChangeEditPageNumber) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSelectPage message handlers BOOL CSelectPage::OnInitDialog() { CDialog::OnInitDialog(); CString csTitle; switch (m_nDlgType) { case SELECT_PAGE_SHOW: csTitle = "Show Page"; break; case SELECT_PAGE_DEL: csTitle = "Delete Page"; break; } SetWindowText(csTitle); m_edtPageNum.SetWindowText(_TEXT("1")); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CSelectPage::OnChangeEditPageNumber() { CString csPage; m_edtPageNum.GetWindowText(csPage); BOOL bOK = TRUE; if (csPage.IsEmpty()) bOK = FALSE; else { int nPage = _ttoi(csPage); bOK = (nPage <= m_nPageCount && nPage >= 1); } m_btnOK.EnableWindow(bOK); }