📄 testpage1.cpp
字号:
// TestPage1.cpp : implementation file
//
#include "stdafx.h"
#include "c02ide.h"
#include "TestPage1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestPage1 dialog
CTestPage1::CTestPage1(CWnd* pParent /*=NULL*/)
: CDialog(CTestPage1::IDD, pParent)
{
//{{AFX_DATA_INIT(CTestPage1)
m_canshutype = _T("");
m_canshuname = _T("");
m_test = _T("");
//}}AFX_DATA_INIT
// lastnum=0;
// addcanshunum=allcanshunum;
// allcanshunum=0;
// functionadd->canshuinfo.SetSize(30);
}
void CTestPage1::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestPage1)
DDX_Control(pDX, IDC_COMBOSELTYPE, m_comcanshutype);
DDX_CBString(pDX, IDC_COMBOSELTYPE, m_canshutype);
DDX_Text(pDX, IDC_EDIT1, m_canshuname);
DDX_Text(pDX, IDC_STATICTEST, m_test);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTestPage1, CDialog)
//{{AFX_MSG_MAP(CTestPage1)
ON_BN_CLICKED(ID_NEXTPAGE, OnNextpage)
ON_BN_CLICKED(IDC_BACK, OnBack)
ON_BN_CLICKED(IDADDFUNCCANCEL, OnAddfunccancel)
ON_BN_CLICKED(IDC_FINISHADD, OnFinishadd)
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_CBN_SELENDOK(IDC_COMBOSELTYPE, OnSelendokComboseltype)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestPage1 message handlers
void CTestPage1::OnNextpage()
{
// TODO: Add your control notification handler code here
//参数类型索引
int canshutypesel=m_comcanshutype.GetCurSel();
// int canshunamesel=m_comcanshuname.GetCurSel();
//参数类型字符串
CString canshutype;
m_comcanshutype.GetLBText(canshutypesel, strcanshutype);
//定义一个参数结构的指针变量
addfuncinfo * funcinfo=NULL;
funcinfo=new addfuncinfo;
//保存参数名称
funcinfo->str_canshuname=strcanshuname;
//保存参数类型
funcinfo->str_canshutype=strcanshutype;
//保存当前获得的参数信息
functionadd->canshuinfo.Add((CObject *)funcinfo);
// int i=addcanshunum;
//当前处理参数索引减一
addcanshunum=addcanshunum-1;
//如果参数索引大于等于2
if (addcanshunum>=2)
{
//销毁当前对话框
DestroyWindow ();
//创建新的参数对话框
nextpage=NULL;
nextpage=new CTestPage1;
nextpage->Create(IDD_TESTPAGE1);
nextpage->ShowWindow(SW_SHOW);
//IDC_BACK按钮可用
nextpage->GetDlgItem(IDC_BACK)->EnableWindow(TRUE);
//ID_NEXTPAGE按钮可用
nextpage->GetDlgItem(ID_NEXTPAGE)->EnableWindow(TRUE);
//IDC_FINISHADD按钮不可用
nextpage->GetDlgItem(IDC_FINISHADD)->EnableWindow(FALSE);
//将编辑框设置为焦点
nextpage->GetDlgItem(IDC_EDIT1)->SetFocus();
}
else
{
//销毁当前对话框
DestroyWindow ();
//创建新的参数对话框
nextpage=NULL;
nextpage=new CTestPage1;
nextpage->Create(IDD_TESTPAGE1);
nextpage->ShowWindow(SW_SHOW);
//IDC_BACK按钮可用
nextpage->GetDlgItem(IDC_BACK)->EnableWindow(TRUE);
//ID_NEXTPAGE按钮不可用
nextpage->GetDlgItem(ID_NEXTPAGE)->EnableWindow(FALSE);
//IDC_FINISHADD按钮可用
nextpage->GetDlgItem(IDC_FINISHADD)->EnableWindow(TRUE);
//将编辑框设置为焦点
nextpage->GetDlgItem(IDC_EDIT1)->SetFocus();
}
}
void CTestPage1::OnCancel()
{
// TODO: Add extra cleanup here//
//CDialog::
DestroyWindow ();
}
void CTestPage1::OnBack()
{
// TODO: Add your control notification handler code here
//当前处理参数索引加一
addcanshunum=addcanshunum+1;
//销毁当前对话框
DestroyWindow ();
//参数索引的上界
int n_end=-1;
n_end=functionadd->canshuinfo.GetUpperBound();
//如果参数信息不为空
if(n_end!=-1)
functionadd->canshuinfo.RemoveAt(n_end);
//创建新的参数对话框
nextpage=NULL;
nextpage=new CTestPage1;
nextpage->Create(IDD_TESTPAGE1);
nextpage->ShowWindow(SW_SHOW);
//如果当前参数索引等于参数的总数
if(addcanshunum==allcanshunum)
{
//ID_NEXTPAGE按钮可用
nextpage->GetDlgItem(ID_NEXTPAGE)->EnableWindow(TRUE);
//IDC_BACK按钮不可用
nextpage->GetDlgItem(IDC_BACK)->EnableWindow(FALSE);
//IDC_FINISHADD按钮不可用
nextpage->GetDlgItem(IDC_FINISHADD)->EnableWindow(FALSE);
//将编辑框设置为焦点
nextpage->GetDlgItem(IDC_EDIT1)->SetFocus();
}
else
{
//ID_NEXTPAGE按钮可用
nextpage->GetDlgItem(ID_NEXTPAGE)->EnableWindow(TRUE);
//IDC_BACK按钮可用
nextpage->GetDlgItem(IDC_BACK)->EnableWindow(TRUE);
//IDC_FINISHADD按钮不可用
nextpage->GetDlgItem(IDC_FINISHADD)->EnableWindow(FALSE);
//将编辑框设置为焦点
nextpage->GetDlgItem(IDC_EDIT1)->SetFocus();
}
}
void CTestPage1::OnAddfunccancel()
{
// TODO: Add your control notification handler code here
DestroyWindow ();
}
void CTestPage1::OnFinishadd()
{
// TODO: Add your control notification handler code here
//参数类型索引
int canshutypesel=m_comcanshutype.GetCurSel();
//参数类型字符串
m_comcanshutype.GetLBText(canshutypesel, strcanshutype);
//定义一个参数结构的指针变量
addfuncinfo * funcinfo=NULL;
funcinfo=new addfuncinfo;
//保存参数名称
funcinfo->str_canshuname=strcanshuname;
//保存参数类型
funcinfo->str_canshutype=strcanshutype;
//保存当前获得的参数信息
functionadd->canshuinfo.Add((CObject *)funcinfo);
//销毁当前对话框
DestroyWindow ();
// 创建函数信息显示对话框
myaddok=new(AddFuncOk);
myaddok->Create(IDD_FUNCINPUTOK);
//初始化
myaddok->Inittext();
myaddok->ShowWindow(SW_SHOW);
}
void CTestPage1::OnChangeEdit1()
{
UpdateData();
m_test = _T("");
strcanshuname = m_canshuname;
UpdateData(FALSE);
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CTestPage1::PostNcDestroy()
{
// TODO: Add your specialized code here and/or call the base class
CDialog::PostNcDestroy();
}
void CTestPage1::OnSelendokComboseltype()
{
// TODO: Add your control notification handler code here
UpdateData();
int canshutypesel=m_comcanshutype.GetCurSel();
m_comcanshutype.GetLBText(canshutypesel, strcanshutype);
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -