// SelectPage.cpp : implementation file // #include "stdafx.h" #include "OCRUTIL.h" #include "SelectPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSelectPage dialog CSelectPage::CSelectPage(L_INT nDlgType, L_INT nPageCount, CWnd* pParent /*=NULL*/) : CDialog(CSelectPage::IDD, pParent) { //{{AFX_DATA_INIT(CSelectPage) m_nPageNum = 1; //}}AFX_DATA_INIT m_nPageCount = nPageCount; m_nDlgType = nDlgType; } void CSelectPage::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSelectPage) 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 void CSelectPage::OnChangeEditPageNumber() { CString csPage; m_edtPageNum.GetWindowText(csPage); L_BOOL bOK = TRUE; if (csPage.IsEmpty()) bOK = FALSE; else { int nPage = _ttoi(csPage); bOK = (nPage <= m_nPageCount && nPage >= 1); } m_btnOK.EnableWindow(bOK); } BOOL CSelectPage::OnInitDialog() { CDialog::OnInitDialog(); CString csTitle; switch (m_nDlgType) { case SELECT_PAGE_SHOW: csTitle = TEXT("Show Page"); break; case SELECT_PAGE_DEL: csTitle = TEXT("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 }