📄 propertydlg.cpp
字号:
// PropertyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "c02ide.h"
#include "PropertyDlg.h"
#include "MainFrm.h"
#include "c02ide.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPropertyDlg
IMPLEMENT_DYNAMIC(CPropertyDlg, CPropertySheet)
CPropertyDlg::CPropertyDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}
CPropertyDlg::CPropertyDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
addcanshunum=-1;
allcanshunum=-1;
// addfuncname="";
//addfunctype="";
// addcanshuname.RemoveAll();
//addcanshutype.RemoveAll();
AddPage (&m_AddFuncPage);
AddPage (&mydelfuncpage);
// AddPage (&m_ColorPage);
m_psh.dwFlags |= PSH_PROPTITLE;
mypage=NULL;
}
CPropertyDlg::~CPropertyDlg()
{
}
BEGIN_MESSAGE_MAP(CPropertyDlg, CPropertySheet)
//{{AFX_MSG_MAP(CPropertyDlg)
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_COMMAND(ID_APPLY_NOW, OnApply)
ON_COMMAND(IDOK, OnOK)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropertyDlg message handlers
int CPropertyDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
return -1;
// m_AddFuncPage.GetDlgItem(IDC_EDIT)->SetFocus();
return 0;
}
void CPropertyDlg::OnOK()
{
//默认
// OnApply();
//活动页指针
CPropertyPage * curpage;
curpage=this->GetActivePage();
//获得活动页索引
int i=0;
if (*curpage==m_AddFuncPage) i=1;
if (*curpage==mydelfuncpage) i=2;
//如果是函数添加页
if(i==1)
{
/*
if(this->m_AddFuncPage.n_selfile==-1)
{
AfxMessageBox(_T("Please select the file you want to add functiont to."));
// return;
}
if(this->m_AddFuncPage.m_edittext==_T(""))
{
AfxMessageBox(_T("Please in put function name."));
return;
}
if(this->m_AddFuncPage.m_seltype==-1)
{
AfxMessageBox(_T("Please select the type of the function value."));
return;
}
if(this->m_AddFuncPage.m_canshuno==-1)
{
AfxMessageBox(_T("Please select the number of parameter."));
return;
}
if(this->m_AddFuncPage.n_selfile==-1||
this->m_AddFuncPage.m_edittext==_T("")||
this->m_AddFuncPage.m_seltype==-1||
this->m_AddFuncPage.m_canshuno==-1)
{
EndDialog (IDOK);
return;
}
*/
//如果参数个数大于等于2
if (allcanshunum>=2)
{
//创建一个非模态对话框,用户 输入参数信息
mypage=new CTestPage1;
mypage->Create(IDD_TESTPAGE1);
mypage->ShowWindow(SW_SHOW);
//将编辑框设为焦点
mypage->GetDlgItem(IDC_EDIT1)->SetFocus();
}
else
{
//如果参数个数等于1
if(allcanshunum==1)
{
//创建一个非模态对话框 ,用户输入参数信息
mypage=new CTestPage1;
mypage->Create(IDD_TESTPAGE1);
mypage->ShowWindow(SW_SHOW);
//下一页按钮不可用
mypage->GetDlgItem(ID_NEXTPAGE)->EnableWindow(FALSE);
//完成按钮可用
mypage->GetDlgItem(IDC_FINISHADD)->EnableWindow(TRUE);
//将编辑框设为焦点
mypage->GetDlgItem(IDC_EDIT1)->SetFocus();
}
else
{
if(allcanshunum==0)
{
//创建一个非模态对话框 ,显示添加函数的相关信息
myaddok=new(AddFuncOk);
myaddok->Create(IDD_FUNCINPUTOK);
myaddok->ShowWindow(SW_SHOW);
myaddok->Inittext();
}
else
{
EndDialog (IDOK);
return;
}
}
}
}
//如果是第二个属性页面
if(i==2)
{
if(this->mydelfuncpage.n_delfileno==-1)
{
AfxMessageBox(_T("Please select the file you want to delete function from."));
return;
}
if(this->mydelfuncpage.n_selfuncno==-1)
{
AfxMessageBox(_T("Please select the index of the function you want to delete."));
return;
}
//转到第二页的处理函数
if(this->mydelfuncpage.n_delfileno!=-1&&this->mydelfuncpage.n_selfuncno!=-1)
this->mydelfuncpage.OnOK();
}
//销毁对话框
EndDialog (IDOK);
return;
}
void CPropertyDlg::OnApply()
{
OnOK();
// m_FontPage.SetModified (FALSE);
// m_ColorPage.SetModified (FALSE);
}
void CPropertyDlg::PostNcDestroy()
{
// TODO: Add your specialized code here and/or call the base class
CPropertySheet::PostNcDestroy();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -