home *** CD-ROM | disk | FTP | other *** search
- // DlgField.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "MDB.h"
- #include "DlgField.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CDlgField dialog
-
-
- CDlgField::CDlgField(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgField::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgField)
- m_strFieldName = _T("");
- m_nTextLength = 1;
- m_nFieldType = 0;
- //}}AFX_DATA_INIT
- }
-
-
- void CDlgField::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgField)
- DDX_Text(pDX, IDC_FIELD_NAME, m_strFieldName);
- DDX_Text(pDX, IDC_FIELD_TEXT_LEN, m_nTextLength);
- DDV_MinMaxInt(pDX, m_nTextLength, 1, 255);
- DDX_Radio(pDX, IDC_FIELD_TYPE, m_nFieldType);
- //}}AFX_DATA_MAP
-
- if ( ! pDX->m_bSaveAndValidate )
- {
- SetWindowText( m_strCaption );
- if ( m_nFieldType ) //Non-text field
- OnFieldTypeNumeric( );
- else
- OnFieldTypeText( );
- OnChangeFieldName( );
- }
- }
-
-
- BEGIN_MESSAGE_MAP(CDlgField, CDialog)
- //{{AFX_MSG_MAP(CDlgField)
- ON_BN_CLICKED(IDC_FIELD_TYPE, OnFieldTypeText)
- ON_BN_CLICKED(IDC_FIELD_TYPE2, OnFieldTypeNumeric)
- ON_BN_CLICKED(IDC_FIELD_TYPE3, OnFieldTypeNumeric)
- ON_EN_CHANGE(IDC_FIELD_NAME, OnChangeFieldName)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CDlgField message handlers
-
-
- void CDlgField::OnFieldTypeText()
- {
- // TODO: Add your control notification handler code here
-
- CEdit * pEdit = ( CEdit * ) GetDlgItem( IDC_FIELD_TEXT_LEN );
- pEdit->SetReadOnly( FALSE );
- GetDlgItem( IDC_FIELD_TEXT_LEN )->SetFocus( );
- }
-
- void CDlgField::OnFieldTypeNumeric()
- {
- // TODO: Add your control notification handler code here
-
- CEdit * pEdit = ( CEdit * ) GetDlgItem( IDC_FIELD_TEXT_LEN );
- pEdit->SetReadOnly( TRUE );
- }
-
- void CDlgField::OnChangeFieldName()
- {
- // TODO: Add your control notification handler code here
-
- CEdit * pEdit = ( CEdit * ) GetDlgItem( IDC_FIELD_NAME );
- CButton * pBtn = ( CButton * ) GetDlgItem( IDOK );
- pBtn->EnableWindow( pEdit->LineLength( ) );
- }
-