www.pudn.com > c02 vc6.rar > AddFuncPage.cpp


// AddFuncPage.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "c02ide.h" 
#include "AddFuncPage.h" 
 
 
//#include "WizardDlg.h" 
#include "Testpage1.h" 
//#include "Testpage2.h" 
//include "Testpage3.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CAddFuncPage property page 
 
IMPLEMENT_DYNCREATE(CAddFuncPage, CPropertyPage) 
 
CAddFuncPage::CAddFuncPage() : CPropertyPage(CAddFuncPage::IDD) 
{ 
	//{{AFX_DATA_INIT(CAddFuncPage) 
	m_edittext = _T(""); 
	m_test = _T(""); 
	m_type = _T(""); 
	m_zykuohao = _T(""); 
	m_seltype = -1; 
	m_canshuno = -1; 
	m_addfile = _T(""); 
	//}}AFX_DATA_INIT 
 
  
	n_selfile=-1; 
	m_seltype=-1; 
	m_canshuno=-1; 
	//参数总数 
    allcanshunum=-1; 
	//当前处理参数编号 
	addcanshunum=-1; 
 
 
 
    functionadd=new AddFunc ; 	 
    
} 
 
CAddFuncPage::~CAddFuncPage() 
{ 
} 
 
void CAddFuncPage::DoDataExchange(CDataExchange* pDX) 
{ 
	CPropertyPage::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAddFuncPage) 
	DDX_Control(pDX, IDC_COMBO3, m_comaddfile); 
	DDX_Control(pDX, IDC_COMBO2, m_canshucom); 
	DDX_Control(pDX, IDC_COMBO1, m_typecom); 
	DDX_Text(pDX, IDC_EDIT, m_edittext); 
	DDV_MaxChars(pDX, m_edittext, 66); 
	DDX_Text(pDX, IDC_STATICTEST, m_test); 
	DDX_Text(pDX, IDC_STATICTYPE, m_type); 
	DDX_Text(pDX, IDC_STATICZY, m_zykuohao); 
	DDX_CBIndex(pDX, IDC_COMBO1, m_seltype); 
	DDX_CBIndex(pDX, IDC_COMBO2, m_canshuno); 
	DDX_CBString(pDX, IDC_COMBO3, m_addfile); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CAddFuncPage, CPropertyPage) 
	//{{AFX_MSG_MAP(CAddFuncPage) 
//	ON_BN_CLICKED(IDC_BUTTONADDFUNC, OnButtonaddfunc) 
	ON_EN_CHANGE(IDC_EDIT, OnChangeEdit) 
	ON_CBN_SELENDOK(IDC_COMBO1, OnSelendokCombo1) 
	ON_CBN_SELENDOK(IDC_COMBO2, OnSelendokCombo2) 
	ON_CBN_SELENDOK(IDC_COMBO3, OnSelendokCombo3) 
//	ON_COMMAND(ID_COMBOBOXFILE, OnComboboxfile) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CAddFuncPage message handlers 
 
 
BOOL CAddFuncPage::OnInitDialog()  
{ 
	//系统定义的属性单页面更新 
	CPropertyPage::OnInitDialog(); 
	//开始更新 
	UpdateData(); 
	//清除file下拉框列表中的内容 
	m_comaddfile.ResetContent(); 
	//获得当前项目信息指针 
	struct ProjectList * curaddpro=NULL;          
	curaddpro=new ProjectList; 
	curaddpro=(ProjectList *)projectinfo.GetAt(0); 
	 
	//项目中的文件个数 
	int n_addfile=0; 
	int n_filenum=curaddpro->proinfstru.GetSize(); 
//	CMDIChildWnd * m_ptestwnd=NULL; 
//	m_ptestwnd=new CMDIChildWnd ; 
 
	//文件信息指针 
	FileList * m_paddfile=NULL; 
	m_paddfile=new FileList; 
	CString str_comfile; 
		for(int j=0;j<=n_filenum-1;j++) 
		{ 
			//取 第j个文件 
			m_paddfile=(FileList *)curaddpro->proinfstru.GetAt(j); 
		    //取文件名 
			str_comfile=m_paddfile->str_filename; 
			//向列表框中加入文件名 
//			m_comaddfile.AddString(str_comfile); 
			m_comaddfile.InsertString(j,str_comfile); 
		} 
 
    //停止更新数据 
	UpdateData(FALSE); 
	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
 
/* 
void CAddFuncPage::OnButtonaddfunc()  
{ 
  
} 
*/ 
void CAddFuncPage::OnChangeEdit()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CPropertyPage::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	//更新数据 
	UpdateData(); 
    //静态文本框文本 
	m_test = _T(""); 
	m_test = m_edittext;   
	//更新函数名字符串 
    functionadd->str_funcname= m_edittext; 
    //对话框数据更新停止 
	UpdateData(FALSE); 
//	SetEnabled(); 
} 
 
//当下拉框下拉列表选择完成时此函数响应 
void CAddFuncPage::OnSelendokCombo1()  
{ 
	// TODO: Add your control notification handler code here 
	//更新数据 
	UpdateData(); 
    //获得下拉列表当前选择的索引 
    int selno=m_typecom.GetCurSel(); 
	//获得下拉列表当前选择的字符串 
	m_typecom.GetLBText(selno, strtype); 
	//静态文本框文本 
    m_type=strtype+":"; 
	//保存函数返回值类型字符串 
    functionadd->str_functype=strtype; 
	//对话框数据更新停止 
	UpdateData(FALSE); 
 
} 
 
//当参数个数下拉框下拉列表选择完成时此函数响应 
void CAddFuncPage::OnSelendokCombo2()  
{ 
	// TODO: Add your control notification handler code here 
	//更新数据 
	UpdateData(); 
     //当前选择的索引 
    int selno=m_canshucom.GetCurSel(); 
	//参数个数字符串 
	CString strnum; 
	m_canshucom.GetLBText(selno, strnum); 
	 
	int i; 
	//字符串转化为整数 
    i = atoi(strnum);  
 
	//设置参数总数 
    allcanshunum=i; 
	//设置当前处理参数编号 
	addcanshunum=i; 
    functionadd->canshunumber=i; 
	//对话框数据更新停止 
    UpdateData(FALSE); 
} 
 
void CAddFuncPage::PostNcDestroy()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	 
 
	CPropertyPage::PostNcDestroy(); 
} 
 
void CAddFuncPage::OnSelendokCombo3()  
{ 
	// TODO: Add your control notification handler code here 
	//更新数据 
	UpdateData(); 
    //当前选择的索引 
    int selfileno=m_comaddfile.GetCurSel(); 
//	int n_cal=m_comaddfile.GetCount(); 
//   CString strfilenm; 
//	m_comaddfile.GetLBText(selfileno, strfilenm); 
    //如果选择出错 
	if(selfileno==CB_ERR) 
		AfxMessageBox("no this file"); 
    //保存选择信息 
	functionadd->n_addfileno=m_comaddfile.GetCurSel(); 
	//对话框数据更新停止 
	UpdateData(FALSE); 
 
 
}