home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK11 / MFC / SAMPLES / CTRLTEST / SUBTEST.CP$ / subtest
Encoding:
Text File  |  1992-03-13  |  1.8 KB  |  71 lines

  1. // subedit.cpp : SubClassed Edit control example
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 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 documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "ctrltest.h"
  14. #include "paredit.h"
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // Dialog class
  18.  
  19. class CSubEditDlg : public CModalDialog
  20. {
  21. protected:
  22.     CParsedEdit edit1, edit2, edit3, edit4;
  23. public:
  24.     CSubEditDlg()
  25.         : CModalDialog(IDD_SUB_EDIT)
  26.             { }
  27.  
  28.     BOOL OnInitDialog();
  29.     void OnOK();
  30. };
  31.  
  32. BOOL CSubEditDlg::OnInitDialog()
  33. {
  34.     edit1.SubclassEdit(IDC_EDIT1, this, PES_LETTERS);
  35.     edit2.SubclassEdit(IDC_EDIT2, this, PES_NUMBERS);
  36.     edit3.SubclassEdit(IDC_EDIT3, this, PES_NUMBERS | PES_LETTERS);
  37.     edit4.SubclassEdit(IDC_EDIT4, this, PES_ALL);
  38.     return TRUE;
  39. }
  40.  
  41. void CSubEditDlg::OnOK()
  42. {
  43. #ifdef _DEBUG
  44.     // dump results, normally you would do something with these
  45.     CString s;
  46.     edit1.GetWindowText(s);
  47.     TRACE("edit1 = '%s'\n", (const char*) s);
  48.     edit2.GetWindowText(s);
  49.     TRACE("edit2 = '%s'\n", (const char*) s);
  50.     edit3.GetWindowText(s);
  51.     TRACE("edit3 = '%s'\n", (const char*) s);
  52.     edit4.GetWindowText(s);
  53.     TRACE("edit4 = '%s'\n", (const char*) s);
  54. #endif
  55.  
  56.     EndDialog(IDOK);
  57. }
  58.  
  59. /////////////////////////////////////////////////////////////////////////////
  60. // Run the test
  61.  
  62. void CTestWindow::OnTestSubclassedEdit()
  63. {
  64.     TRACE("running dialog containing edit items aliased to ParsedEdits\n");
  65.     CSubEditDlg dlg;
  66.     dlg.DoModal();
  67. }
  68.  
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71.