home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / appwiz / hierwiz / editdlg.cpp < prev    next >
C/C++ Source or Header  |  1998-03-05  |  2KB  |  92 lines

  1. // editdlg.cpp : implementation file
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "hierwiz.h"
  15. #include "editdlg.h"
  16. #include "hierwaw.h"
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char BASED_CODE THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CEditDlg dialog
  25.  
  26.  
  27. CEditDlg::CEditDlg()
  28.     : CAppWizStepDlg(CEditDlg::IDD)
  29. {
  30.     //{{AFX_DATA_INIT(CEditDlg)
  31.     m_SampleTxt = _T("");
  32.     //}}AFX_DATA_INIT
  33. }
  34.  
  35.  
  36. //DDX_Control(pDX, IDC_SAMPLETXT, m_EditCtrl);
  37.  
  38. void CEditDlg::DoDataExchange(CDataExchange* pDX)
  39. {
  40.     CDialog::DoDataExchange(pDX);
  41.     //{{AFX_DATA_MAP(CEditDlg)
  42.     DDX_Text(pDX, IDC_SAMPLETXT, m_SampleTxt);
  43.     //}}AFX_DATA_MAP
  44. }
  45.  
  46. BOOL CEditDlg::OnDismiss()
  47. {
  48.     if (!UpdateData(TRUE))
  49.         return FALSE;
  50.     if ((m_SampleTxt.IsEmpty())== 0)
  51.     {
  52.         hierwizaw.m_Dictionary.SetAt("USER_INPUT_DATA",m_SampleTxt) ;
  53.         hierwizaw.m_Dictionary.RemoveKey("NO_INPUT_DATA") ;
  54.     }
  55.     else
  56.     {
  57.         CString strNoTxt;
  58.         strNoTxt.LoadString(IDS_NOSAMPLETXT) ;
  59.         if(IDNO == (AfxMessageBox(strNoTxt,MB_YESNO)))
  60.         {
  61.             return FALSE ;
  62.         }
  63.         else
  64.         {
  65.             // No text data is entered.
  66.             hierwizaw.m_Dictionary.RemoveKey("USER_INPUT_DATA") ;
  67.             hierwizaw.m_Dictionary.SetAt("NO_INPUT_DATA","YES") ;
  68.         }
  69.     }
  70.     return TRUE;    // return FALSE if the dialog shouldn't be dismissed
  71. }
  72.  
  73.  
  74. BEGIN_MESSAGE_MAP(CEditDlg, CDialog)
  75.     //{{AFX_MSG_MAP(CEditDlg)
  76.     //}}AFX_MSG_MAP
  77. END_MESSAGE_MAP()
  78.  
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CEditDlg message handlers
  82.  
  83.  
  84. BOOL CEditDlg::OnInitDialog()
  85. {
  86.     CDialog::OnInitDialog();
  87.     VERIFY(m_EditData.SubclassDlgItem(IDC_SAMPLETXT,this)) ;
  88.     m_EditData.SetTabStops(10) ;
  89.     return TRUE;  // return TRUE unless you set the focus to a control
  90.                   // EXCEPTION: OCX Property Pages should return FALSE
  91. }
  92.