home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / database / daotable / addtbdlg.h < prev    next >
C/C++ Source or Header  |  1998-03-26  |  4KB  |  97 lines

  1. // AddTbDlg.h : header file
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 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 related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. // maximum number of types of fields
  14. #define MAX_TYPES 12
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CDlgAddTable dialog
  18.  
  19. class CDlgAddTable : public CDialog
  20. {
  21. // Construction
  22. public:
  23.     void setTypeDependentStatesAndExisting(int theType, BOOL bExistingField);
  24.     int m_nFieldIndex;
  25.     BOOL m_bCheckDDV;   // if TRUE, execute DDV checks in DoDataExchange
  26.     BOOL m_bFirstFieldAdded;    // TRUE after first field added to tabledef
  27.     int m_nTypeMap[MAX_TYPES];  // combobox list to actual type constants
  28.     CDaoTableDef * m_pTableDef; // points to the tabledef used to create table
  29.     CDaoDatabase * m_pDatabase; // incoming database pointer on which to base tabledef
  30.  
  31.     CDlgAddTable(CWnd* pParent = NULL);   // standard constructor
  32.     // constructor that takes a database pointer--the one we really use
  33.     CDlgAddTable(CDaoDatabase *pDatabase, CString strTableName, CWnd * pParent = NULL);
  34.     // check if a type selection was made
  35.     void DDV_NoSel(CDataExchange* pDX, CComboBox *theControl);
  36.     // initialize all the dialog data, other members
  37.     void initializer();
  38.     // initialize the field info (ordinal position is conditional)
  39.     void fieldInitializer(BOOL bInitOrdPos = TRUE);
  40.     // create new field in table with error checks for duplicates/failure
  41.     BOOL CreateNewField();
  42.     // create new tabledef with error checks for duplicates/failure
  43.     BOOL CreateNewTableDef();
  44.  
  45.     // this enum corresponds to order of strings in type combobox
  46.     enum theTypes { Boolean, Byte, Currency, Date, Double, Long,
  47.                     LongBinary, Memo, Short, Single, Text };
  48.  
  49. // Dialog Data
  50.     // controls on the dialog and data they transfer from/to
  51.     //{{AFX_DATA(CDlgAddTable)
  52.     enum { IDD = IDD_ADD_TABLE_DLG };
  53.     CEdit   m_ValidationTextControl;
  54.     CEdit   m_ValidationRuleControl;
  55.     CButton m_RequireControl;
  56.     CEdit   m_OrdinalPositionControl;
  57.     CEdit   m_TableNameControl;
  58.     CEdit   m_NameControl;
  59.     CEdit   m_SizeControl;
  60.     CEdit   m_DefaultValueControl;
  61.     CButton m_AutoIncrFieldControl;
  62.     CButton m_FieldVariabilityControl;
  63.     CComboBox   m_TypeControl;
  64.     CString m_strTableName;
  65.     CDaoFieldInfo m_FI;
  66.     int     m_FieldVariability;
  67.     BOOL    m_bAutoIncrField;
  68.     CString m_strValidationRule;
  69.     CString m_strValidationText;
  70.     //}}AFX_DATA
  71.  
  72.  
  73. // Overrides
  74.     // ClassWizard generated virtual function overrides
  75.     //{{AFX_VIRTUAL(CDlgAddTable)
  76.     protected:
  77.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  78.     //}}AFX_VIRTUAL
  79.  
  80. // Implementation
  81. protected:
  82.  
  83.     // Generated message map functions
  84.     //{{AFX_MSG(CDlgAddTable)
  85.     virtual BOOL OnInitDialog();
  86.     afx_msg void OnNextField(); // user selected to add a field or move to next
  87.     afx_msg void OnSelendokType();  // user selected a type for the field
  88.     afx_msg void OnDone();  // user done adding fields, ready to append tabledef
  89.     afx_msg void OnClose(); // user cancelled out of creating a table
  90.     afx_msg void OnPreviousField();
  91.     afx_msg void OnDeleteField();
  92.     afx_msg void OnAddField();
  93.     afx_msg void OnCloseupType();
  94.     //}}AFX_MSG
  95.     DECLARE_MESSAGE_MAP()
  96. };
  97.