www.gusucode.com > VC++开发的ACD树形策略编辑器-源码程序 > VC++开发的ACD树形策略编辑器-源码程序/code/Convert.cpp
//Download by http://www.NewXing.com // Convert.cpp : implementation file // #include "stdafx.h" #include "dsACD_IVR.h" #include "Convert.h" #include "dsACD_IVRDoc.h" #include "dsACD_IVRView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CConvert dialog CConvert::CConvert(CWnd* pParent /*=NULL*/) : CDialog(CConvert::IDD, pParent) { //{{AFX_DATA_INIT(CConvert) m_nPlace = 0; m_nLength = 0; m_csComment = _T(""); m_csType = _T(""); m_csVariable = _T(""); //}}AFX_DATA_INIT } void CConvert::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CConvert) DDX_Control(pDX, IDC_STATIC2, m_StaticLength); DDX_Control(pDX, IDC_STATIC1, m_StaticPlace); DDX_Control(pDX, IDC_SPINPLACE, m_SpinPlace); DDX_Control(pDX, IDC_SPINLENGTH, m_SpinLength); DDX_Text(pDX, IDC_SUBSTRPLACE, m_nPlace); DDX_Text(pDX, IDC_SUBSTRLENGTH, m_nLength); DDX_Text(pDX, IDC_CHARCOMMENT, m_csComment); DDX_CBString(pDX, IDC_CONVERTTYPE, m_csType); DDX_CBString(pDX, IDC_CONVERTVAR, m_csVariable); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CConvert, CDialog) //{{AFX_MSG_MAP(CConvert) ON_CBN_SELENDOK(IDC_CONVERTTYPE, OnSelendokConverttype) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CConvert message handlers BOOL CConvert::OnInitDialog() { CDialog::OnInitDialog(); CSpinButtonCtrl* pSpin1 = (CSpinButtonCtrl*) GetDlgItem(IDC_SPINPLACE); CSpinButtonCtrl* pSpin2 = (CSpinButtonCtrl*) GetDlgItem(IDC_SPINLENGTH); pSpin1->SetRange(0, 1000); pSpin1->SetPos(0); pSpin2->SetRange(0, 1000); pSpin2->SetPos(0); CComboBox *pVariable=(CComboBox *)GetDlgItem(IDC_CONVERTVAR); m_pType=(CComboBox *)GetDlgItem(IDC_CONVERTTYPE); CString buf, csNameString; m_pDsACD_IVRView->ReadVariable(buf); while (!buf.IsEmpty()) { csNameString = buf.Left(buf.Find(";" )); pVariable->AddString(csNameString); buf.Delete(0, buf.Find(";" )+1); } int nIndex; nIndex = pVariable->SelectString(-1, m_csVariable); pVariable->SetCurSel(nIndex); nIndex = m_pType->SelectString(-1, m_csType); m_pType->SetCurSel(nIndex); if (m_csType == "取子串(部分文字)") { m_StaticPlace.EnableWindow(TRUE); m_StaticLength.EnableWindow(TRUE); m_SpinLength.EnableWindow(TRUE); m_SpinPlace.EnableWindow(TRUE); CEdit* pEditPlace=(CEdit*)GetDlgItem(IDC_SUBSTRPLACE); pEditPlace->EnableWindow(TRUE); CEdit* pEditLength=(CEdit*)GetDlgItem(IDC_SUBSTRLENGTH); pEditLength->EnableWindow(TRUE); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CConvert::DisplayDlg(dsACDObjectBase *pObj) { dsChar_INFO * pCharInfo = (dsChar_INFO*) pObj->Read(); m_csVariable = pCharInfo->Variable; m_csType = pCharInfo->Type; m_nPlace = pCharInfo->SubstrPlace; m_nLength = pCharInfo->SubstrLength; m_csComment = pCharInfo->Comment; if(DoModal()==IDOK) { if (m_csVariable == "") m_csVariable = "无变量"; if (m_csType == "") m_csType = "无操作"; pCharInfo->Variable = m_csVariable; pCharInfo->Type = m_csType; pCharInfo->SubstrPlace = m_nPlace ; pCharInfo->SubstrLength = m_nLength ; pCharInfo->Comment = m_csComment ; } else return; } void CConvert::OnSelendokConverttype() { if (m_pType->GetCurSel( ) == 4) { m_StaticPlace.EnableWindow(TRUE); m_StaticLength.EnableWindow(TRUE); m_SpinLength.EnableWindow(TRUE); m_SpinPlace.EnableWindow(TRUE); CEdit* pEditPlace=(CEdit*)GetDlgItem(IDC_SUBSTRPLACE); pEditPlace->EnableWindow(TRUE); CEdit* pEditLength=(CEdit*)GetDlgItem(IDC_SUBSTRLENGTH); pEditLength->EnableWindow(TRUE); } else { m_StaticPlace.EnableWindow(FALSE); m_StaticLength.EnableWindow(FALSE); m_SpinLength.EnableWindow(FALSE); m_SpinPlace.EnableWindow(FALSE); CEdit* pEditPlace=(CEdit*)GetDlgItem(IDC_SUBSTRPLACE); pEditPlace->EnableWindow(FALSE); CEdit* pEditLength=(CEdit*)GetDlgItem(IDC_SUBSTRLENGTH); pEditLength->EnableWindow(FALSE); } }