home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c10 / lab01 / baseline / finddlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  1.9 KB  |  74 lines

  1. // FindDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Browser.h"
  6. #include "FindDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CFindDlg dialog
  16.  
  17.  
  18. CFindDlg::CFindDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CFindDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CFindDlg)
  22.     m_nMatchType = -1;
  23.     m_strFind = _T("");
  24.     //}}AFX_DATA_INIT
  25. }
  26.  
  27.  
  28. void CFindDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30.     CDialog::DoDataExchange(pDX);
  31.     //{{AFX_DATA_MAP(CFindDlg)
  32.     DDX_Radio(pDX, IDC_RADIO_MATCH, m_nMatchType);
  33.     DDX_Text(pDX, IDC_EDIT1, m_strFind);
  34.     //}}AFX_DATA_MAP
  35. }
  36.  
  37.  
  38. BEGIN_MESSAGE_MAP(CFindDlg, CDialog)
  39.     //{{AFX_MSG_MAP(CFindDlg)
  40.     //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CFindDlg message handlers
  45.  
  46. BOOL CFindDlg::OnInitDialog() 
  47. {
  48.     CDialog::OnInitDialog();
  49.     // TODO: Add extra initialization here
  50.  
  51.     CButton * pRadio; 
  52.     if ( EXACT == m_nMatchType )   //Must not be a text field
  53.     {
  54.         pRadio = ( CButton * ) GetDlgItem( IDC_RADIO_MATCH2 ); //EXACT
  55.         pRadio->EnableWindow( TRUE );
  56.         pRadio = ( CButton * ) GetDlgItem( IDC_RADIO_MATCH );  //LIKE
  57.         pRadio->EnableWindow( FALSE );
  58.         pRadio = ( CButton * ) GetDlgItem( IDC_RADIO_MATCH3 ); //CONTAINS
  59.         pRadio->EnableWindow( FALSE );
  60.     }
  61.     else   //We can do anything with text
  62.     {
  63.         pRadio = ( CButton * ) GetDlgItem( IDC_RADIO_MATCH2 );
  64.         pRadio->EnableWindow( TRUE );
  65.         pRadio = ( CButton * ) GetDlgItem( IDC_RADIO_MATCH );
  66.         pRadio->EnableWindow( TRUE );
  67.         pRadio = ( CButton * ) GetDlgItem( IDC_RADIO_MATCH3 );
  68.         pRadio->EnableWindow( TRUE );
  69.     }
  70.  
  71.     return TRUE;  // return TRUE unless you set the focus to a control
  72.                   // EXCEPTION: OCX Property Pages should return FALSE
  73. }
  74.